@asgard-js/core 0.3.63 → 0.3.64

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
@@ -12,8 +12,8 @@ class w extends Error {
12
12
  // `body` is optional because every construction site derives it from a response whose text or JSON
13
13
  // may fail to parse, yielding `undefined` or `null`. An absent body is therefore a normal outcome
14
14
  // rather than a caller mistake, and a test raising a status-only error need not pass a filler value.
15
- constructor(t, e, r) {
16
- super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = r;
15
+ constructor(t, e, s) {
16
+ super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = s;
17
17
  }
18
18
  }
19
19
  function _n(n) {
@@ -43,65 +43,65 @@ class ee extends Error {
43
43
  super("Cannot send this turn while the channel is awaiting a tool-call consent response."), this.name = "ChannelAwaitingConsentError", this.processId = t;
44
44
  }
45
45
  }
46
- function Un(n) {
46
+ function Mn(n) {
47
47
  return n instanceof ee;
48
48
  }
49
- var $ = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))($ || {}), l = /* @__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.PROMPT_SUGGESTION = "asgard.prompt_suggestion", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(l || {}), Xe = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Xe || {}), Ve = /* @__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.QUESTION = "QUESTION", n))(Ve || {});
49
+ var $ = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))($ || {}), l = /* @__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.MESSAGE_CANVAS_START = "asgard.message.canvas.start", n.MESSAGE_CANVAS_DELTA = "asgard.message.canvas.delta", n.MESSAGE_CANVAS_COMPLETE = "asgard.message.canvas.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.PROMPT_SUGGESTION = "asgard.prompt_suggestion", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(l || {}), Xe = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Xe || {}), Ie = /* @__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.QUESTION = "QUESTION", n.CANVAS = "CANVAS", n))(Ie || {});
50
50
  async function ze(n, t) {
51
51
  const e = n.getReader();
52
- let r;
53
- for (; !(r = await e.read()).done; )
54
- t(r.value);
52
+ let s;
53
+ for (; !(s = await e.read()).done; )
54
+ t(s.value);
55
55
  }
56
56
  function Je(n) {
57
- let t, e, r, s = !1;
57
+ let t, e, s, r = !1;
58
58
  return function(i) {
59
- t === void 0 ? (t = i, e = 0, r = -1) : t = Ze(t, i);
59
+ t === void 0 ? (t = i, e = 0, s = -1) : t = Ze(t, i);
60
60
  const a = t.length;
61
- let u = 0;
61
+ let c = 0;
62
62
  for (; e < a; ) {
63
- s && (t[e] === 10 && (u = ++e), s = !1);
64
- let c = -1;
65
- for (; e < a && c === -1; ++e)
63
+ r && (t[e] === 10 && (c = ++e), r = !1);
64
+ let u = -1;
65
+ for (; e < a && u === -1; ++e)
66
66
  switch (t[e]) {
67
67
  case 58:
68
- r === -1 && (r = e - u);
68
+ s === -1 && (s = e - c);
69
69
  break;
70
70
  case 13:
71
- s = !0;
71
+ r = !0;
72
72
  case 10:
73
- c = e;
73
+ u = e;
74
74
  break;
75
75
  }
76
- if (c === -1)
76
+ if (u === -1)
77
77
  break;
78
- n(t.subarray(u, c), r), u = e, r = -1;
78
+ n(t.subarray(c, u), s), c = e, s = -1;
79
79
  }
80
- u === a ? t = void 0 : u !== 0 && (t = t.subarray(u), e -= u);
80
+ c === a ? t = void 0 : c !== 0 && (t = t.subarray(c), e -= c);
81
81
  };
82
82
  }
83
83
  function Qe(n, t, e) {
84
- let r = ce();
85
- const s = new TextDecoder();
84
+ let s = ue();
85
+ const r = new TextDecoder();
86
86
  return function(i, a) {
87
87
  if (i.length === 0)
88
- e?.(r), r = ce();
88
+ e?.(s), s = ue();
89
89
  else if (a > 0) {
90
- const u = s.decode(i.subarray(0, a)), c = a + (i[a + 1] === 32 ? 2 : 1), h = s.decode(i.subarray(c));
91
- switch (u) {
90
+ const c = r.decode(i.subarray(0, a)), u = a + (i[a + 1] === 32 ? 2 : 1), h = r.decode(i.subarray(u));
91
+ switch (c) {
92
92
  case "data":
93
- r.data = r.data ? r.data + `
93
+ s.data = s.data ? s.data + `
94
94
  ` + h : h;
95
95
  break;
96
96
  case "event":
97
- r.event = h;
97
+ s.event = h;
98
98
  break;
99
99
  case "id":
100
- n(r.id = h);
100
+ n(s.id = h);
101
101
  break;
102
102
  case "retry":
103
103
  const m = parseInt(h, 10);
104
- isNaN(m) || t(r.retry = m);
104
+ isNaN(m) || t(s.retry = m);
105
105
  break;
106
106
  }
107
107
  }
@@ -111,7 +111,7 @@ function Ze(n, t) {
111
111
  const e = new Uint8Array(n.length + t.length);
112
112
  return e.set(n), e.set(t, n.length), e;
113
113
  }
114
- function ce() {
114
+ function ue() {
115
115
  return {
116
116
  data: "",
117
117
  event: "",
@@ -121,33 +121,33 @@ function ce() {
121
121
  }
122
122
  var et = function(n, t) {
123
123
  var e = {};
124
- for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && t.indexOf(r) < 0 && (e[r] = n[r]);
124
+ for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && t.indexOf(s) < 0 && (e[s] = n[s]);
125
125
  if (n != null && typeof Object.getOwnPropertySymbols == "function")
126
- for (var s = 0, r = Object.getOwnPropertySymbols(n); s < r.length; s++)
127
- t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[s]) && (e[r[s]] = n[r[s]]);
126
+ for (var r = 0, s = Object.getOwnPropertySymbols(n); r < s.length; r++)
127
+ t.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, s[r]) && (e[s[r]] = n[s[r]]);
128
128
  return e;
129
129
  };
130
130
  const te = "text/event-stream", tt = 1e3, le = "last-event-id";
131
131
  function Ee(n, t) {
132
- var { signal: e, headers: r, onopen: s, onmessage: o, onclose: i, onerror: a, openWhenHidden: u, fetch: c } = t, h = et(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
132
+ var { signal: e, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: c, fetch: u } = t, h = et(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
133
133
  return new Promise((m, v) => {
134
- const d = Object.assign({}, r);
134
+ const d = Object.assign({}, s);
135
135
  d.accept || (d.accept = te);
136
136
  let p;
137
137
  function f() {
138
- p.abort(), document.hidden || X();
138
+ p.abort(), document.hidden || W();
139
139
  }
140
- u || document.addEventListener("visibilitychange", f);
141
- let _ = tt, E = 0;
140
+ c || document.addEventListener("visibilitychange", f);
141
+ let _ = tt, I = 0;
142
142
  function L() {
143
- document.removeEventListener("visibilitychange", f), window.clearTimeout(E), p.abort();
143
+ document.removeEventListener("visibilitychange", f), window.clearTimeout(I), p.abort();
144
144
  }
145
145
  e?.addEventListener("abort", () => {
146
146
  L(), m();
147
147
  });
148
- const Ye = c ?? window.fetch, We = s ?? nt;
149
- async function X() {
150
- var V;
148
+ const Ye = u ?? window.fetch, We = r ?? nt;
149
+ async function W() {
150
+ var X;
151
151
  p = new AbortController();
152
152
  try {
153
153
  const H = await Ye(n, Object.assign(Object.assign({}, h), { headers: d, signal: p.signal }));
@@ -159,14 +159,14 @@ function Ee(n, t) {
159
159
  } catch (H) {
160
160
  if (!p.signal.aborted)
161
161
  try {
162
- const x = (V = a?.(H)) !== null && V !== void 0 ? V : _;
163
- window.clearTimeout(E), E = window.setTimeout(X, x);
162
+ const x = (X = a?.(H)) !== null && X !== void 0 ? X : _;
163
+ window.clearTimeout(I), I = window.setTimeout(W, x);
164
164
  } catch (x) {
165
165
  L(), v(x);
166
166
  }
167
167
  }
168
168
  }
169
- X();
169
+ W();
170
170
  });
171
171
  }
172
172
  function nt(n) {
@@ -175,10 +175,10 @@ function nt(n) {
175
175
  throw new Error(`Expected content-type to be ${te}, Actual: ${t}`);
176
176
  }
177
177
  var ne = function(n, t) {
178
- return ne = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
179
- e.__proto__ = r;
180
- } || function(e, r) {
181
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
178
+ return ne = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, s) {
179
+ e.__proto__ = s;
180
+ } || function(e, s) {
181
+ for (var r in s) Object.prototype.hasOwnProperty.call(s, r) && (e[r] = s[r]);
182
182
  }, ne(n, t);
183
183
  };
184
184
  function C(n, t) {
@@ -190,8 +190,8 @@ function C(n, t) {
190
190
  }
191
191
  n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
192
192
  }
193
- function rt(n, t, e, r) {
194
- function s(o) {
193
+ function st(n, t, e, s) {
194
+ function r(o) {
195
195
  return o instanceof e ? o : new e(function(i) {
196
196
  i(o);
197
197
  });
@@ -199,90 +199,90 @@ function rt(n, t, e, r) {
199
199
  return new (e || (e = Promise))(function(o, i) {
200
200
  function a(h) {
201
201
  try {
202
- c(r.next(h));
202
+ u(s.next(h));
203
203
  } catch (m) {
204
204
  i(m);
205
205
  }
206
206
  }
207
- function u(h) {
207
+ function c(h) {
208
208
  try {
209
- c(r.throw(h));
209
+ u(s.throw(h));
210
210
  } catch (m) {
211
211
  i(m);
212
212
  }
213
213
  }
214
- function c(h) {
215
- h.done ? o(h.value) : s(h.value).then(a, u);
214
+ function u(h) {
215
+ h.done ? o(h.value) : r(h.value).then(a, c);
216
216
  }
217
- c((r = r.apply(n, t || [])).next());
217
+ u((s = s.apply(n, t || [])).next());
218
218
  });
219
219
  }
220
- function Ie(n, t) {
220
+ function Te(n, t) {
221
221
  var e = { label: 0, sent: function() {
222
222
  if (o[0] & 1) throw o[1];
223
223
  return o[1];
224
- }, trys: [], ops: [] }, r, s, o, i = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
224
+ }, trys: [], ops: [] }, s, r, o, i = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
225
225
  return i.next = a(0), i.throw = a(1), i.return = a(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
226
226
  return this;
227
227
  }), i;
228
- function a(c) {
228
+ function a(u) {
229
229
  return function(h) {
230
- return u([c, h]);
230
+ return c([u, h]);
231
231
  };
232
232
  }
233
- function u(c) {
234
- if (r) throw new TypeError("Generator is already executing.");
235
- for (; i && (i = 0, c[0] && (e = 0)), e; ) try {
236
- if (r = 1, s && (o = c[0] & 2 ? s.return : c[0] ? s.throw || ((o = s.return) && o.call(s), 0) : s.next) && !(o = o.call(s, c[1])).done) return o;
237
- switch (s = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
233
+ function c(u) {
234
+ if (s) throw new TypeError("Generator is already executing.");
235
+ for (; i && (i = 0, u[0] && (e = 0)), e; ) try {
236
+ if (s = 1, r && (o = u[0] & 2 ? r.return : u[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, u[1])).done) return o;
237
+ switch (r = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
238
238
  case 0:
239
239
  case 1:
240
- o = c;
240
+ o = u;
241
241
  break;
242
242
  case 4:
243
- return e.label++, { value: c[1], done: !1 };
243
+ return e.label++, { value: u[1], done: !1 };
244
244
  case 5:
245
- e.label++, s = c[1], c = [0];
245
+ e.label++, r = u[1], u = [0];
246
246
  continue;
247
247
  case 7:
248
- c = e.ops.pop(), e.trys.pop();
248
+ u = e.ops.pop(), e.trys.pop();
249
249
  continue;
250
250
  default:
251
- if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
251
+ if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
252
252
  e = 0;
253
253
  continue;
254
254
  }
255
- if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
256
- e.label = c[1];
255
+ if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
256
+ e.label = u[1];
257
257
  break;
258
258
  }
259
- if (c[0] === 6 && e.label < o[1]) {
260
- e.label = o[1], o = c;
259
+ if (u[0] === 6 && e.label < o[1]) {
260
+ e.label = o[1], o = u;
261
261
  break;
262
262
  }
263
263
  if (o && e.label < o[2]) {
264
- e.label = o[2], e.ops.push(c);
264
+ e.label = o[2], e.ops.push(u);
265
265
  break;
266
266
  }
267
267
  o[2] && e.ops.pop(), e.trys.pop();
268
268
  continue;
269
269
  }
270
- c = t.call(n, e);
270
+ u = t.call(n, e);
271
271
  } catch (h) {
272
- c = [6, h], s = 0;
272
+ u = [6, h], r = 0;
273
273
  } finally {
274
- r = o = 0;
274
+ s = o = 0;
275
275
  }
276
- if (c[0] & 5) throw c[1];
277
- return { value: c[0] ? c[1] : void 0, done: !0 };
276
+ if (u[0] & 5) throw u[1];
277
+ return { value: u[0] ? u[1] : void 0, done: !0 };
278
278
  }
279
279
  }
280
280
  function k(n) {
281
- var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
281
+ var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], s = 0;
282
282
  if (e) return e.call(n);
283
283
  if (n && typeof n.length == "number") return {
284
284
  next: function() {
285
- return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
285
+ return n && s >= n.length && (n = void 0), { value: n && n[s++], done: !n };
286
286
  }
287
287
  };
288
288
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
@@ -290,14 +290,14 @@ function k(n) {
290
290
  function D(n, t) {
291
291
  var e = typeof Symbol == "function" && n[Symbol.iterator];
292
292
  if (!e) return n;
293
- var r = e.call(n), s, o = [], i;
293
+ var s = e.call(n), r, o = [], i;
294
294
  try {
295
- for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; ) o.push(s.value);
295
+ for (; (t === void 0 || t-- > 0) && !(r = s.next()).done; ) o.push(r.value);
296
296
  } catch (a) {
297
297
  i = { error: a };
298
298
  } finally {
299
299
  try {
300
- s && !s.done && (e = r.return) && e.call(r);
300
+ r && !r.done && (e = s.return) && e.call(s);
301
301
  } finally {
302
302
  if (i) throw i.error;
303
303
  }
@@ -305,84 +305,84 @@ function D(n, t) {
305
305
  return o;
306
306
  }
307
307
  function F(n, t, e) {
308
- if (e || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
309
- (o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
308
+ if (e || arguments.length === 2) for (var s = 0, r = t.length, o; s < r; s++)
309
+ (o || !(s in t)) && (o || (o = Array.prototype.slice.call(t, 0, s)), o[s] = t[s]);
310
310
  return n.concat(o || Array.prototype.slice.call(t));
311
311
  }
312
312
  function N(n) {
313
313
  return this instanceof N ? (this.v = n, this) : new N(n);
314
314
  }
315
- function st(n, t, e) {
315
+ function rt(n, t, e) {
316
316
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
317
- var r = e.apply(n, t || []), s, o = [];
318
- return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", i), s[Symbol.asyncIterator] = function() {
317
+ var s = e.apply(n, t || []), r, o = [];
318
+ return r = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", i), r[Symbol.asyncIterator] = function() {
319
319
  return this;
320
- }, s;
320
+ }, r;
321
321
  function i(d) {
322
322
  return function(p) {
323
323
  return Promise.resolve(p).then(d, m);
324
324
  };
325
325
  }
326
326
  function a(d, p) {
327
- r[d] && (s[d] = function(f) {
328
- return new Promise(function(_, E) {
329
- o.push([d, f, _, E]) > 1 || u(d, f);
327
+ s[d] && (r[d] = function(f) {
328
+ return new Promise(function(_, I) {
329
+ o.push([d, f, _, I]) > 1 || c(d, f);
330
330
  });
331
- }, p && (s[d] = p(s[d])));
331
+ }, p && (r[d] = p(r[d])));
332
332
  }
333
- function u(d, p) {
333
+ function c(d, p) {
334
334
  try {
335
- c(r[d](p));
335
+ u(s[d](p));
336
336
  } catch (f) {
337
337
  v(o[0][3], f);
338
338
  }
339
339
  }
340
- function c(d) {
340
+ function u(d) {
341
341
  d.value instanceof N ? Promise.resolve(d.value.v).then(h, m) : v(o[0][2], d);
342
342
  }
343
343
  function h(d) {
344
- u("next", d);
344
+ c("next", d);
345
345
  }
346
346
  function m(d) {
347
- u("throw", d);
347
+ c("throw", d);
348
348
  }
349
349
  function v(d, p) {
350
- d(p), o.shift(), o.length && u(o[0][0], o[0][1]);
350
+ d(p), o.shift(), o.length && c(o[0][0], o[0][1]);
351
351
  }
352
352
  }
353
353
  function ot(n) {
354
354
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
355
355
  var t = n[Symbol.asyncIterator], e;
356
- 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() {
356
+ return t ? t.call(n) : (n = typeof k == "function" ? k(n) : n[Symbol.iterator](), e = {}, s("next"), s("throw"), s("return"), e[Symbol.asyncIterator] = function() {
357
357
  return this;
358
358
  }, e);
359
- function r(o) {
359
+ function s(o) {
360
360
  e[o] = n[o] && function(i) {
361
- return new Promise(function(a, u) {
362
- i = n[o](i), s(a, u, i.done, i.value);
361
+ return new Promise(function(a, c) {
362
+ i = n[o](i), r(a, c, i.done, i.value);
363
363
  });
364
364
  };
365
365
  }
366
- function s(o, i, a, u) {
367
- Promise.resolve(u).then(function(c) {
368
- o({ value: c, done: a });
366
+ function r(o, i, a, c) {
367
+ Promise.resolve(c).then(function(u) {
368
+ o({ value: u, done: a });
369
369
  }, i);
370
370
  }
371
371
  }
372
- function g(n) {
372
+ function b(n) {
373
373
  return typeof n == "function";
374
374
  }
375
- function Te(n) {
376
- var t = function(r) {
377
- Error.call(r), r.stack = new Error().stack;
375
+ function Ce(n) {
376
+ var t = function(s) {
377
+ Error.call(s), s.stack = new Error().stack;
378
378
  }, e = n(t);
379
379
  return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
380
380
  }
381
- var z = Te(function(n) {
381
+ var z = Ce(function(n) {
382
382
  return function(e) {
383
383
  n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
384
- ` + e.map(function(r, s) {
385
- return s + 1 + ") " + r.toString();
384
+ ` + e.map(function(s, r) {
385
+ return r + 1 + ") " + s.toString();
386
386
  }).join(`
387
387
  `) : "", this.name = "UnsubscriptionError", this.errors = e;
388
388
  };
@@ -398,22 +398,22 @@ var j = (function() {
398
398
  this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
399
399
  }
400
400
  return n.prototype.unsubscribe = function() {
401
- var t, e, r, s, o;
401
+ var t, e, s, r, o;
402
402
  if (!this.closed) {
403
403
  this.closed = !0;
404
404
  var i = this._parentage;
405
405
  if (i)
406
406
  if (this._parentage = null, Array.isArray(i))
407
407
  try {
408
- for (var a = k(i), u = a.next(); !u.done; u = a.next()) {
409
- var c = u.value;
410
- c.remove(this);
408
+ for (var a = k(i), c = a.next(); !c.done; c = a.next()) {
409
+ var u = c.value;
410
+ u.remove(this);
411
411
  }
412
412
  } catch (f) {
413
413
  t = { error: f };
414
414
  } finally {
415
415
  try {
416
- u && !u.done && (e = a.return) && e.call(a);
416
+ c && !c.done && (e = a.return) && e.call(a);
417
417
  } finally {
418
418
  if (t) throw t.error;
419
419
  }
@@ -421,7 +421,7 @@ var j = (function() {
421
421
  else
422
422
  i.remove(this);
423
423
  var h = this.initialTeardown;
424
- if (g(h))
424
+ if (b(h))
425
425
  try {
426
426
  h();
427
427
  } catch (f) {
@@ -440,12 +440,12 @@ var j = (function() {
440
440
  }
441
441
  }
442
442
  } catch (f) {
443
- r = { error: f };
443
+ s = { error: f };
444
444
  } finally {
445
445
  try {
446
- d && !d.done && (s = v.return) && s.call(v);
446
+ d && !d.done && (r = v.return) && r.call(v);
447
447
  } finally {
448
- if (r) throw r.error;
448
+ if (s) throw s.error;
449
449
  }
450
450
  }
451
451
  }
@@ -481,19 +481,19 @@ var j = (function() {
481
481
  var t = new n();
482
482
  return t.closed = !0, t;
483
483
  })(), n;
484
- })(), Ce = j.EMPTY;
485
- function xe(n) {
486
- return n instanceof j || n && "closed" in n && g(n.remove) && g(n.add) && g(n.unsubscribe);
484
+ })(), xe = j.EMPTY;
485
+ function Ae(n) {
486
+ return n instanceof j || n && "closed" in n && b(n.remove) && b(n.add) && b(n.unsubscribe);
487
487
  }
488
488
  function de(n) {
489
- g(n) ? n() : n.unsubscribe();
489
+ b(n) ? n() : n.unsubscribe();
490
490
  }
491
491
  var it = {
492
492
  Promise: void 0
493
493
  }, at = {
494
494
  setTimeout: function(n, t) {
495
- for (var e = [], r = 2; r < arguments.length; r++)
496
- e[r - 2] = arguments[r];
495
+ for (var e = [], s = 2; s < arguments.length; s++)
496
+ e[s - 2] = arguments[s];
497
497
  return setTimeout.apply(void 0, F([n, t], D(e)));
498
498
  },
499
499
  clearTimeout: function(n) {
@@ -506,7 +506,7 @@ function Oe(n) {
506
506
  throw n;
507
507
  });
508
508
  }
509
- function re() {
509
+ function se() {
510
510
  }
511
511
  function B(n) {
512
512
  n();
@@ -514,11 +514,11 @@ function B(n) {
514
514
  var oe = (function(n) {
515
515
  C(t, n);
516
516
  function t(e) {
517
- var r = n.call(this) || this;
518
- return r.isStopped = !1, e ? (r.destination = e, xe(e) && e.add(r)) : r.destination = lt, r;
517
+ var s = n.call(this) || this;
518
+ return s.isStopped = !1, e ? (s.destination = e, Ae(e) && e.add(s)) : s.destination = lt, s;
519
519
  }
520
- return t.create = function(e, r, s) {
521
- return new se(e, r, s);
520
+ return t.create = function(e, s, r) {
521
+ return new re(e, s, r);
522
522
  }, t.prototype.next = function(e) {
523
523
  this.isStopped || this._next(e);
524
524
  }, t.prototype.error = function(e) {
@@ -542,7 +542,7 @@ var oe = (function(n) {
542
542
  this.unsubscribe();
543
543
  }
544
544
  }, t;
545
- })(j), ut = (function() {
545
+ })(j), ct = (function() {
546
546
  function n(t) {
547
547
  this.partialObserver = t;
548
548
  }
@@ -551,16 +551,16 @@ var oe = (function(n) {
551
551
  if (e.next)
552
552
  try {
553
553
  e.next(t);
554
- } catch (r) {
555
- G(r);
554
+ } catch (s) {
555
+ G(s);
556
556
  }
557
557
  }, n.prototype.error = function(t) {
558
558
  var e = this.partialObserver;
559
559
  if (e.error)
560
560
  try {
561
561
  e.error(t);
562
- } catch (r) {
563
- G(r);
562
+ } catch (s) {
563
+ G(s);
564
564
  }
565
565
  else
566
566
  G(t);
@@ -573,39 +573,39 @@ var oe = (function(n) {
573
573
  G(e);
574
574
  }
575
575
  }, n;
576
- })(), se = (function(n) {
576
+ })(), re = (function(n) {
577
577
  C(t, n);
578
- function t(e, r, s) {
578
+ function t(e, s, r) {
579
579
  var o = n.call(this) || this, i;
580
- return g(e) || !e ? i = {
580
+ return b(e) || !e ? i = {
581
581
  next: e ?? void 0,
582
- error: r ?? void 0,
583
- complete: s ?? void 0
584
- } : i = e, o.destination = new ut(i), o;
582
+ error: s ?? void 0,
583
+ complete: r ?? void 0
584
+ } : i = e, o.destination = new ct(i), o;
585
585
  }
586
586
  return t;
587
587
  })(oe);
588
588
  function G(n) {
589
589
  Oe(n);
590
590
  }
591
- function ct(n) {
591
+ function ut(n) {
592
592
  throw n;
593
593
  }
594
594
  var lt = {
595
595
  closed: !0,
596
- next: re,
597
- error: ct,
598
- complete: re
596
+ next: se,
597
+ error: ut,
598
+ complete: se
599
599
  }, ie = (function() {
600
600
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
601
601
  })();
602
- function W(n) {
602
+ function Y(n) {
603
603
  return n;
604
604
  }
605
605
  function dt(n) {
606
- return n.length === 0 ? W : n.length === 1 ? n[0] : function(e) {
607
- return n.reduce(function(r, s) {
608
- return s(r);
606
+ return n.length === 0 ? Y : n.length === 1 ? n[0] : function(e) {
607
+ return n.reduce(function(s, r) {
608
+ return r(s);
609
609
  }, e);
610
610
  };
611
611
  }
@@ -616,11 +616,11 @@ var y = (function() {
616
616
  return n.prototype.lift = function(t) {
617
617
  var e = new n();
618
618
  return e.source = this, e.operator = t, e;
619
- }, n.prototype.subscribe = function(t, e, r) {
620
- var s = this, o = ft(t) ? t : new se(t, e, r);
619
+ }, n.prototype.subscribe = function(t, e, s) {
620
+ var r = this, o = ft(t) ? t : new re(t, e, s);
621
621
  return B(function() {
622
- var i = s, a = i.operator, u = i.source;
623
- o.add(a ? a.call(o, u) : u ? s._subscribe(o) : s._trySubscribe(o));
622
+ var i = r, a = i.operator, c = i.source;
623
+ o.add(a ? a.call(o, c) : c ? r._subscribe(o) : r._trySubscribe(o));
624
624
  }), o;
625
625
  }, n.prototype._trySubscribe = function(t) {
626
626
  try {
@@ -629,20 +629,20 @@ var y = (function() {
629
629
  t.error(e);
630
630
  }
631
631
  }, n.prototype.forEach = function(t, e) {
632
- var r = this;
633
- return e = he(e), new e(function(s, o) {
634
- var i = new se({
632
+ var s = this;
633
+ return e = he(e), new e(function(r, o) {
634
+ var i = new re({
635
635
  next: function(a) {
636
636
  try {
637
637
  t(a);
638
- } catch (u) {
639
- o(u), i.unsubscribe();
638
+ } catch (c) {
639
+ o(c), i.unsubscribe();
640
640
  }
641
641
  },
642
642
  error: o,
643
- complete: s
643
+ complete: r
644
644
  });
645
- r.subscribe(i);
645
+ s.subscribe(i);
646
646
  });
647
647
  }, n.prototype._subscribe = function(t) {
648
648
  var e;
@@ -655,14 +655,14 @@ var y = (function() {
655
655
  return dt(t)(this);
656
656
  }, n.prototype.toPromise = function(t) {
657
657
  var e = this;
658
- return t = he(t), new t(function(r, s) {
658
+ return t = he(t), new t(function(s, r) {
659
659
  var o;
660
660
  e.subscribe(function(i) {
661
661
  return o = i;
662
662
  }, function(i) {
663
- return s(i);
663
+ return r(i);
664
664
  }, function() {
665
- return r(o);
665
+ return s(o);
666
666
  });
667
667
  });
668
668
  }, n.create = function(t) {
@@ -674,13 +674,13 @@ function he(n) {
674
674
  return (t = n ?? it.Promise) !== null && t !== void 0 ? t : Promise;
675
675
  }
676
676
  function ht(n) {
677
- return n && g(n.next) && g(n.error) && g(n.complete);
677
+ return n && b(n.next) && b(n.error) && b(n.complete);
678
678
  }
679
679
  function ft(n) {
680
- return n && n instanceof oe || ht(n) && xe(n);
680
+ return n && n instanceof oe || ht(n) && Ae(n);
681
681
  }
682
682
  function pt(n) {
683
- return g(n?.lift);
683
+ return b(n?.lift);
684
684
  }
685
685
  function P(n) {
686
686
  return function(t) {
@@ -688,52 +688,52 @@ function P(n) {
688
688
  return t.lift(function(e) {
689
689
  try {
690
690
  return n(e, this);
691
- } catch (r) {
692
- this.error(r);
691
+ } catch (s) {
692
+ this.error(s);
693
693
  }
694
694
  });
695
695
  throw new TypeError("Unable to lift unknown Observable type");
696
696
  };
697
697
  }
698
- function A(n, t, e, r, s) {
699
- return new mt(n, t, e, r, s);
698
+ function O(n, t, e, s, r) {
699
+ return new mt(n, t, e, s, r);
700
700
  }
701
701
  var mt = (function(n) {
702
702
  C(t, n);
703
- function t(e, r, s, o, i, a) {
704
- var u = n.call(this, e) || this;
705
- return u.onFinalize = i, u.shouldUnsubscribe = a, u._next = r ? function(c) {
703
+ function t(e, s, r, o, i, a) {
704
+ var c = n.call(this, e) || this;
705
+ return c.onFinalize = i, c.shouldUnsubscribe = a, c._next = s ? function(u) {
706
706
  try {
707
- r(c);
707
+ s(u);
708
708
  } catch (h) {
709
709
  e.error(h);
710
710
  }
711
- } : n.prototype._next, u._error = o ? function(c) {
711
+ } : n.prototype._next, c._error = o ? function(u) {
712
712
  try {
713
- o(c);
713
+ o(u);
714
714
  } catch (h) {
715
715
  e.error(h);
716
716
  } finally {
717
717
  this.unsubscribe();
718
718
  }
719
- } : n.prototype._error, u._complete = s ? function() {
719
+ } : n.prototype._error, c._complete = r ? function() {
720
720
  try {
721
- s();
722
- } catch (c) {
723
- e.error(c);
721
+ r();
722
+ } catch (u) {
723
+ e.error(u);
724
724
  } finally {
725
725
  this.unsubscribe();
726
726
  }
727
- } : n.prototype._complete, u;
727
+ } : n.prototype._complete, c;
728
728
  }
729
729
  return t.prototype.unsubscribe = function() {
730
730
  var e;
731
731
  if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
732
- var r = this.closed;
733
- n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
732
+ var s = this.closed;
733
+ n.prototype.unsubscribe.call(this), !s && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
734
734
  }
735
735
  }, t;
736
- })(oe), gt = Te(function(n) {
736
+ })(oe), gt = Ce(function(n) {
737
737
  return function() {
738
738
  n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
739
739
  };
@@ -744,40 +744,40 @@ var mt = (function(n) {
744
744
  return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
745
745
  }
746
746
  return t.prototype.lift = function(e) {
747
- var r = new fe(this, this);
748
- return r.operator = e, r;
747
+ var s = new fe(this, this);
748
+ return s.operator = e, s;
749
749
  }, t.prototype._throwIfClosed = function() {
750
750
  if (this.closed)
751
751
  throw new gt();
752
752
  }, t.prototype.next = function(e) {
753
- var r = this;
753
+ var s = this;
754
754
  B(function() {
755
- var s, o;
756
- if (r._throwIfClosed(), !r.isStopped) {
757
- r.currentObservers || (r.currentObservers = Array.from(r.observers));
755
+ var r, o;
756
+ if (s._throwIfClosed(), !s.isStopped) {
757
+ s.currentObservers || (s.currentObservers = Array.from(s.observers));
758
758
  try {
759
- for (var i = k(r.currentObservers), a = i.next(); !a.done; a = i.next()) {
760
- var u = a.value;
761
- u.next(e);
759
+ for (var i = k(s.currentObservers), a = i.next(); !a.done; a = i.next()) {
760
+ var c = a.value;
761
+ c.next(e);
762
762
  }
763
- } catch (c) {
764
- s = { error: c };
763
+ } catch (u) {
764
+ r = { error: u };
765
765
  } finally {
766
766
  try {
767
767
  a && !a.done && (o = i.return) && o.call(i);
768
768
  } finally {
769
- if (s) throw s.error;
769
+ if (r) throw r.error;
770
770
  }
771
771
  }
772
772
  }
773
773
  });
774
774
  }, t.prototype.error = function(e) {
775
- var r = this;
775
+ var s = this;
776
776
  B(function() {
777
- if (r._throwIfClosed(), !r.isStopped) {
778
- r.hasError = r.isStopped = !0, r.thrownError = e;
779
- for (var s = r.observers; s.length; )
780
- s.shift().error(e);
777
+ if (s._throwIfClosed(), !s.isStopped) {
778
+ s.hasError = s.isStopped = !0, s.thrownError = e;
779
+ for (var r = s.observers; r.length; )
780
+ r.shift().error(e);
781
781
  }
782
782
  });
783
783
  }, t.prototype.complete = function() {
@@ -785,8 +785,8 @@ var mt = (function(n) {
785
785
  B(function() {
786
786
  if (e._throwIfClosed(), !e.isStopped) {
787
787
  e.isStopped = !0;
788
- for (var r = e.observers; r.length; )
789
- r.shift().complete();
788
+ for (var s = e.observers; s.length; )
789
+ s.shift().complete();
790
790
  }
791
791
  });
792
792
  }, t.prototype.unsubscribe = function() {
@@ -803,43 +803,43 @@ var mt = (function(n) {
803
803
  }, t.prototype._subscribe = function(e) {
804
804
  return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
805
805
  }, t.prototype._innerSubscribe = function(e) {
806
- var r = this, s = this, o = s.hasError, i = s.isStopped, a = s.observers;
807
- return o || i ? Ce : (this.currentObservers = null, a.push(e), new j(function() {
808
- r.currentObservers = null, K(a, e);
806
+ var s = this, r = this, o = r.hasError, i = r.isStopped, a = r.observers;
807
+ return o || i ? xe : (this.currentObservers = null, a.push(e), new j(function() {
808
+ s.currentObservers = null, K(a, e);
809
809
  }));
810
810
  }, t.prototype._checkFinalizedStatuses = function(e) {
811
- var r = this, s = r.hasError, o = r.thrownError, i = r.isStopped;
812
- s ? e.error(o) : i && e.complete();
811
+ var s = this, r = s.hasError, o = s.thrownError, i = s.isStopped;
812
+ r ? e.error(o) : i && e.complete();
813
813
  }, t.prototype.asObservable = function() {
814
814
  var e = new y();
815
815
  return e.source = this, e;
816
- }, t.create = function(e, r) {
817
- return new fe(e, r);
816
+ }, t.create = function(e, s) {
817
+ return new fe(e, s);
818
818
  }, t;
819
819
  })(y), fe = (function(n) {
820
820
  C(t, n);
821
- function t(e, r) {
822
- var s = n.call(this) || this;
823
- return s.destination = e, s.source = r, s;
821
+ function t(e, s) {
822
+ var r = n.call(this) || this;
823
+ return r.destination = e, r.source = s, r;
824
824
  }
825
825
  return t.prototype.next = function(e) {
826
- var r, s;
827
- (s = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || s === void 0 || s.call(r, e);
826
+ var s, r;
827
+ (r = (s = this.destination) === null || s === void 0 ? void 0 : s.next) === null || r === void 0 || r.call(s, e);
828
828
  }, t.prototype.error = function(e) {
829
- var r, s;
830
- (s = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || s === void 0 || s.call(r, e);
829
+ var s, r;
830
+ (r = (s = this.destination) === null || s === void 0 ? void 0 : s.error) === null || r === void 0 || r.call(s, e);
831
831
  }, t.prototype.complete = function() {
832
- var e, r;
833
- (r = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || r === void 0 || r.call(e);
832
+ var e, s;
833
+ (s = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || s === void 0 || s.call(e);
834
834
  }, t.prototype._subscribe = function(e) {
835
- var r, s;
836
- return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s : Ce;
835
+ var s, r;
836
+ return (r = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(e)) !== null && r !== void 0 ? r : xe;
837
837
  }, t;
838
838
  })(ae), T = (function(n) {
839
839
  C(t, n);
840
840
  function t(e) {
841
- var r = n.call(this) || this;
842
- return r._value = e, r;
841
+ var s = n.call(this) || this;
842
+ return s._value = e, s;
843
843
  }
844
844
  return Object.defineProperty(t.prototype, "value", {
845
845
  get: function() {
@@ -848,12 +848,12 @@ var mt = (function(n) {
848
848
  enumerable: !1,
849
849
  configurable: !0
850
850
  }), t.prototype._subscribe = function(e) {
851
- var r = n.prototype._subscribe.call(this, e);
852
- return !r.closed && e.next(this._value), r;
851
+ var s = n.prototype._subscribe.call(this, e);
852
+ return !s.closed && e.next(this._value), s;
853
853
  }, t.prototype.getValue = function() {
854
- var e = this, r = e.hasError, s = e.thrownError, o = e._value;
855
- if (r)
856
- throw s;
854
+ var e = this, s = e.hasError, r = e.thrownError, o = e._value;
855
+ if (s)
856
+ throw r;
857
857
  return this._throwIfClosed(), o;
858
858
  }, t.prototype.next = function(e) {
859
859
  n.prototype.next.call(this, this._value = e);
@@ -864,16 +864,16 @@ var mt = (function(n) {
864
864
  }
865
865
  }, vt = (function(n) {
866
866
  C(t, n);
867
- function t(e, r) {
867
+ function t(e, s) {
868
868
  return n.call(this) || this;
869
869
  }
870
- return t.prototype.schedule = function(e, r) {
870
+ return t.prototype.schedule = function(e, s) {
871
871
  return this;
872
872
  }, t;
873
873
  })(j), pe = {
874
874
  setInterval: function(n, t) {
875
- for (var e = [], r = 2; r < arguments.length; r++)
876
- e[r - 2] = arguments[r];
875
+ for (var e = [], s = 2; s < arguments.length; s++)
876
+ e[s - 2] = arguments[s];
877
877
  return setInterval.apply(void 0, F([n, t], D(e)));
878
878
  },
879
879
  clearInterval: function(n) {
@@ -882,119 +882,119 @@ var mt = (function(n) {
882
882
  delegate: void 0
883
883
  }, St = (function(n) {
884
884
  C(t, n);
885
- function t(e, r) {
886
- var s = n.call(this, e, r) || this;
887
- return s.scheduler = e, s.work = r, s.pending = !1, s;
885
+ function t(e, s) {
886
+ var r = n.call(this, e, s) || this;
887
+ return r.scheduler = e, r.work = s, r.pending = !1, r;
888
888
  }
889
- return t.prototype.schedule = function(e, r) {
890
- var s;
891
- if (r === void 0 && (r = 0), this.closed)
889
+ return t.prototype.schedule = function(e, s) {
890
+ var r;
891
+ if (s === void 0 && (s = 0), this.closed)
892
892
  return this;
893
893
  this.state = e;
894
894
  var o = this.id, i = this.scheduler;
895
- 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;
896
- }, t.prototype.requestAsyncId = function(e, r, s) {
897
- return s === void 0 && (s = 0), pe.setInterval(e.flush.bind(e, this), s);
898
- }, t.prototype.recycleAsyncId = function(e, r, s) {
899
- if (s === void 0 && (s = 0), s != null && this.delay === s && this.pending === !1)
900
- return r;
901
- r != null && pe.clearInterval(r);
902
- }, t.prototype.execute = function(e, r) {
895
+ return o != null && (this.id = this.recycleAsyncId(i, o, s)), this.pending = !0, this.delay = s, this.id = (r = this.id) !== null && r !== void 0 ? r : this.requestAsyncId(i, this.id, s), this;
896
+ }, t.prototype.requestAsyncId = function(e, s, r) {
897
+ return r === void 0 && (r = 0), pe.setInterval(e.flush.bind(e, this), r);
898
+ }, t.prototype.recycleAsyncId = function(e, s, r) {
899
+ if (r === void 0 && (r = 0), r != null && this.delay === r && this.pending === !1)
900
+ return s;
901
+ s != null && pe.clearInterval(s);
902
+ }, t.prototype.execute = function(e, s) {
903
903
  if (this.closed)
904
904
  return new Error("executing a cancelled action");
905
905
  this.pending = !1;
906
- var s = this._execute(e, r);
907
- if (s)
908
- return s;
906
+ var r = this._execute(e, s);
907
+ if (r)
908
+ return r;
909
909
  this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
910
- }, t.prototype._execute = function(e, r) {
911
- var s = !1, o;
910
+ }, t.prototype._execute = function(e, s) {
911
+ var r = !1, o;
912
912
  try {
913
913
  this.work(e);
914
914
  } catch (i) {
915
- s = !0, o = i || new Error("Scheduled action threw falsy error");
915
+ r = !0, o = i || new Error("Scheduled action threw falsy error");
916
916
  }
917
- if (s)
917
+ if (r)
918
918
  return this.unsubscribe(), o;
919
919
  }, t.prototype.unsubscribe = function() {
920
920
  if (!this.closed) {
921
- var e = this, r = e.id, s = e.scheduler, o = s.actions;
922
- this.work = this.state = this.scheduler = null, this.pending = !1, K(o, this), r != null && (this.id = this.recycleAsyncId(s, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
921
+ var e = this, s = e.id, r = e.scheduler, o = r.actions;
922
+ this.work = this.state = this.scheduler = null, this.pending = !1, K(o, this), s != null && (this.id = this.recycleAsyncId(r, s, null)), this.delay = null, n.prototype.unsubscribe.call(this);
923
923
  }
924
924
  }, t;
925
925
  })(vt), me = (function() {
926
926
  function n(t, e) {
927
927
  e === void 0 && (e = n.now), this.schedulerActionCtor = t, this.now = e;
928
928
  }
929
- return n.prototype.schedule = function(t, e, r) {
930
- return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
929
+ return n.prototype.schedule = function(t, e, s) {
930
+ return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(s, e);
931
931
  }, n.now = bt.now, n;
932
932
  })(), yt = (function(n) {
933
933
  C(t, n);
934
- function t(e, r) {
935
- r === void 0 && (r = me.now);
936
- var s = n.call(this, e, r) || this;
937
- return s.actions = [], s._active = !1, s;
934
+ function t(e, s) {
935
+ s === void 0 && (s = me.now);
936
+ var r = n.call(this, e, s) || this;
937
+ return r.actions = [], r._active = !1, r;
938
938
  }
939
939
  return t.prototype.flush = function(e) {
940
- var r = this.actions;
940
+ var s = this.actions;
941
941
  if (this._active) {
942
- r.push(e);
942
+ s.push(e);
943
943
  return;
944
944
  }
945
- var s;
945
+ var r;
946
946
  this._active = !0;
947
947
  do
948
- if (s = e.execute(e.state, e.delay))
948
+ if (r = e.execute(e.state, e.delay))
949
949
  break;
950
- while (e = r.shift());
951
- if (this._active = !1, s) {
952
- for (; e = r.shift(); )
950
+ while (e = s.shift());
951
+ if (this._active = !1, r) {
952
+ for (; e = s.shift(); )
953
953
  e.unsubscribe();
954
- throw s;
954
+ throw r;
955
955
  }
956
956
  }, t;
957
- })(me), Ae = new yt(St), wt = Ae, Et = new y(function(n) {
957
+ })(me), Pe = new yt(St), wt = Pe, It = new y(function(n) {
958
958
  return n.complete();
959
959
  });
960
- function Pe(n) {
961
- return n && g(n.schedule);
962
- }
963
960
  function _e(n) {
961
+ return n && b(n.schedule);
962
+ }
963
+ function Le(n) {
964
964
  return n[n.length - 1];
965
965
  }
966
- function It(n) {
967
- return g(_e(n)) ? n.pop() : void 0;
966
+ function Et(n) {
967
+ return b(Le(n)) ? n.pop() : void 0;
968
968
  }
969
- function Le(n) {
970
- return Pe(_e(n)) ? n.pop() : void 0;
969
+ function Me(n) {
970
+ return _e(Le(n)) ? n.pop() : void 0;
971
971
  }
972
972
  var Ue = (function(n) {
973
973
  return n && typeof n.length == "number" && typeof n != "function";
974
974
  });
975
- function Me(n) {
976
- return g(n?.then);
977
- }
978
975
  function Ne(n) {
979
- return g(n[ie]);
976
+ return b(n?.then);
980
977
  }
981
978
  function ke(n) {
982
- return Symbol.asyncIterator && g(n?.[Symbol.asyncIterator]);
979
+ return b(n[ie]);
983
980
  }
984
981
  function Re(n) {
982
+ return Symbol.asyncIterator && b(n?.[Symbol.asyncIterator]);
983
+ }
984
+ function je(n) {
985
985
  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.");
986
986
  }
987
987
  function Tt() {
988
988
  return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
989
989
  }
990
- var je = Tt();
991
- function $e(n) {
992
- return g(n?.[je]);
993
- }
990
+ var $e = Tt();
994
991
  function De(n) {
995
- return st(this, arguments, function() {
996
- var e, r, s, o;
997
- return Ie(this, function(i) {
992
+ return b(n?.[$e]);
993
+ }
994
+ function Fe(n) {
995
+ return rt(this, arguments, function() {
996
+ var e, s, r, o;
997
+ return Te(this, function(i) {
998
998
  switch (i.label) {
999
999
  case 0:
1000
1000
  e = n.getReader(), i.label = 1;
@@ -1003,11 +1003,11 @@ function De(n) {
1003
1003
  case 2:
1004
1004
  return [4, N(e.read())];
1005
1005
  case 3:
1006
- return r = i.sent(), s = r.value, o = r.done, o ? [4, N(void 0)] : [3, 5];
1006
+ return s = i.sent(), r = s.value, o = s.done, o ? [4, N(void 0)] : [3, 5];
1007
1007
  case 4:
1008
1008
  return [2, i.sent()];
1009
1009
  case 5:
1010
- return [4, N(s)];
1010
+ return [4, N(r)];
1011
1011
  case 6:
1012
1012
  return [4, i.sent()];
1013
1013
  case 7:
@@ -1022,32 +1022,32 @@ function De(n) {
1022
1022
  });
1023
1023
  });
1024
1024
  }
1025
- function Fe(n) {
1026
- return g(n?.getReader);
1025
+ function He(n) {
1026
+ return b(n?.getReader);
1027
1027
  }
1028
- function M(n) {
1028
+ function U(n) {
1029
1029
  if (n instanceof y)
1030
1030
  return n;
1031
1031
  if (n != null) {
1032
- if (Ne(n))
1032
+ if (ke(n))
1033
1033
  return Ct(n);
1034
1034
  if (Ue(n))
1035
1035
  return xt(n);
1036
- if (Me(n))
1037
- return Ot(n);
1038
- if (ke(n))
1039
- return He(n);
1040
- if ($e(n))
1036
+ if (Ne(n))
1041
1037
  return At(n);
1042
- if (Fe(n))
1038
+ if (Re(n))
1039
+ return Ge(n);
1040
+ if (De(n))
1041
+ return Ot(n);
1042
+ if (He(n))
1043
1043
  return Pt(n);
1044
1044
  }
1045
- throw Re(n);
1045
+ throw je(n);
1046
1046
  }
1047
1047
  function Ct(n) {
1048
1048
  return new y(function(t) {
1049
1049
  var e = n[ie]();
1050
- if (g(e.subscribe))
1050
+ if (b(e.subscribe))
1051
1051
  return e.subscribe(t);
1052
1052
  throw new TypeError("Provided object does not correctly implement Symbol.observable");
1053
1053
  });
@@ -1059,7 +1059,7 @@ function xt(n) {
1059
1059
  t.complete();
1060
1060
  });
1061
1061
  }
1062
- function Ot(n) {
1062
+ function At(n) {
1063
1063
  return new y(function(t) {
1064
1064
  n.then(function(e) {
1065
1065
  t.closed || (t.next(e), t.complete());
@@ -1068,11 +1068,11 @@ function Ot(n) {
1068
1068
  }).then(null, Oe);
1069
1069
  });
1070
1070
  }
1071
- function At(n) {
1071
+ function Ot(n) {
1072
1072
  return new y(function(t) {
1073
- var e, r;
1073
+ var e, s;
1074
1074
  try {
1075
- for (var s = k(n), o = s.next(); !o.done; o = s.next()) {
1075
+ for (var r = k(n), o = r.next(); !o.done; o = r.next()) {
1076
1076
  var i = o.value;
1077
1077
  if (t.next(i), t.closed)
1078
1078
  return;
@@ -1081,7 +1081,7 @@ function At(n) {
1081
1081
  e = { error: a };
1082
1082
  } finally {
1083
1083
  try {
1084
- o && !o.done && (r = s.return) && r.call(s);
1084
+ o && !o.done && (s = r.return) && s.call(r);
1085
1085
  } finally {
1086
1086
  if (e) throw e.error;
1087
1087
  }
@@ -1089,7 +1089,7 @@ function At(n) {
1089
1089
  t.complete();
1090
1090
  });
1091
1091
  }
1092
- function He(n) {
1092
+ function Ge(n) {
1093
1093
  return new y(function(t) {
1094
1094
  _t(n, t).catch(function(e) {
1095
1095
  return t.error(e);
@@ -1097,37 +1097,37 @@ function He(n) {
1097
1097
  });
1098
1098
  }
1099
1099
  function Pt(n) {
1100
- return He(De(n));
1100
+ return Ge(Fe(n));
1101
1101
  }
1102
1102
  function _t(n, t) {
1103
- var e, r, s, o;
1104
- return rt(this, void 0, void 0, function() {
1103
+ var e, s, r, o;
1104
+ return st(this, void 0, void 0, function() {
1105
1105
  var i, a;
1106
- return Ie(this, function(u) {
1107
- switch (u.label) {
1106
+ return Te(this, function(c) {
1107
+ switch (c.label) {
1108
1108
  case 0:
1109
- u.trys.push([0, 5, 6, 11]), e = ot(n), u.label = 1;
1109
+ c.trys.push([0, 5, 6, 11]), e = ot(n), c.label = 1;
1110
1110
  case 1:
1111
1111
  return [4, e.next()];
1112
1112
  case 2:
1113
- if (r = u.sent(), !!r.done) return [3, 4];
1114
- if (i = r.value, t.next(i), t.closed)
1113
+ if (s = c.sent(), !!s.done) return [3, 4];
1114
+ if (i = s.value, t.next(i), t.closed)
1115
1115
  return [2];
1116
- u.label = 3;
1116
+ c.label = 3;
1117
1117
  case 3:
1118
1118
  return [3, 1];
1119
1119
  case 4:
1120
1120
  return [3, 11];
1121
1121
  case 5:
1122
- return a = u.sent(), s = { error: a }, [3, 11];
1122
+ return a = c.sent(), r = { error: a }, [3, 11];
1123
1123
  case 6:
1124
- return u.trys.push([6, , 9, 10]), r && !r.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
1124
+ return c.trys.push([6, , 9, 10]), s && !s.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
1125
1125
  case 7:
1126
- u.sent(), u.label = 8;
1126
+ c.sent(), c.label = 8;
1127
1127
  case 8:
1128
1128
  return [3, 10];
1129
1129
  case 9:
1130
- if (s) throw s.error;
1130
+ if (r) throw r.error;
1131
1131
  return [7];
1132
1132
  case 10:
1133
1133
  return [7];
@@ -1137,60 +1137,60 @@ function _t(n, t) {
1137
1137
  });
1138
1138
  });
1139
1139
  }
1140
- function O(n, t, e, r, s) {
1141
- r === void 0 && (r = 0), s === void 0 && (s = !1);
1140
+ function A(n, t, e, s, r) {
1141
+ s === void 0 && (s = 0), r === void 0 && (r = !1);
1142
1142
  var o = t.schedule(function() {
1143
- e(), s ? n.add(this.schedule(null, r)) : this.unsubscribe();
1144
- }, r);
1145
- if (n.add(o), !s)
1143
+ e(), r ? n.add(this.schedule(null, s)) : this.unsubscribe();
1144
+ }, s);
1145
+ if (n.add(o), !r)
1146
1146
  return o;
1147
1147
  }
1148
- function Ge(n, t) {
1149
- return t === void 0 && (t = 0), P(function(e, r) {
1150
- e.subscribe(A(r, function(s) {
1151
- return O(r, n, function() {
1152
- return r.next(s);
1148
+ function Be(n, t) {
1149
+ return t === void 0 && (t = 0), P(function(e, s) {
1150
+ e.subscribe(O(s, function(r) {
1151
+ return A(s, n, function() {
1152
+ return s.next(r);
1153
1153
  }, t);
1154
1154
  }, function() {
1155
- return O(r, n, function() {
1156
- return r.complete();
1155
+ return A(s, n, function() {
1156
+ return s.complete();
1157
1157
  }, t);
1158
- }, function(s) {
1159
- return O(r, n, function() {
1160
- return r.error(s);
1158
+ }, function(r) {
1159
+ return A(s, n, function() {
1160
+ return s.error(r);
1161
1161
  }, t);
1162
1162
  }));
1163
1163
  });
1164
1164
  }
1165
- function Be(n, t) {
1166
- return t === void 0 && (t = 0), P(function(e, r) {
1167
- r.add(n.schedule(function() {
1168
- return e.subscribe(r);
1165
+ function qe(n, t) {
1166
+ return t === void 0 && (t = 0), P(function(e, s) {
1167
+ s.add(n.schedule(function() {
1168
+ return e.subscribe(s);
1169
1169
  }, t));
1170
1170
  });
1171
1171
  }
1172
1172
  function Lt(n, t) {
1173
- return M(n).pipe(Be(t), Ge(t));
1174
- }
1175
- function Ut(n, t) {
1176
- return M(n).pipe(Be(t), Ge(t));
1173
+ return U(n).pipe(qe(t), Be(t));
1177
1174
  }
1178
1175
  function Mt(n, t) {
1176
+ return U(n).pipe(qe(t), Be(t));
1177
+ }
1178
+ function Ut(n, t) {
1179
1179
  return new y(function(e) {
1180
- var r = 0;
1180
+ var s = 0;
1181
1181
  return t.schedule(function() {
1182
- r === n.length ? e.complete() : (e.next(n[r++]), e.closed || this.schedule());
1182
+ s === n.length ? e.complete() : (e.next(n[s++]), e.closed || this.schedule());
1183
1183
  });
1184
1184
  });
1185
1185
  }
1186
1186
  function Nt(n, t) {
1187
1187
  return new y(function(e) {
1188
- var r;
1189
- return O(e, t, function() {
1190
- r = n[je](), O(e, t, function() {
1191
- var s, o, i;
1188
+ var s;
1189
+ return A(e, t, function() {
1190
+ s = n[$e](), A(e, t, function() {
1191
+ var r, o, i;
1192
1192
  try {
1193
- s = r.next(), o = s.value, i = s.done;
1193
+ r = s.next(), o = r.value, i = r.done;
1194
1194
  } catch (a) {
1195
1195
  e.error(a);
1196
1196
  return;
@@ -1198,61 +1198,61 @@ function Nt(n, t) {
1198
1198
  i ? e.complete() : e.next(o);
1199
1199
  }, 0, !0);
1200
1200
  }), function() {
1201
- return g(r?.return) && r.return();
1201
+ return b(s?.return) && s.return();
1202
1202
  };
1203
1203
  });
1204
1204
  }
1205
- function qe(n, t) {
1205
+ function Ke(n, t) {
1206
1206
  if (!n)
1207
1207
  throw new Error("Iterable cannot be null");
1208
1208
  return new y(function(e) {
1209
- O(e, t, function() {
1210
- var r = n[Symbol.asyncIterator]();
1211
- O(e, t, function() {
1212
- r.next().then(function(s) {
1213
- s.done ? e.complete() : e.next(s.value);
1209
+ A(e, t, function() {
1210
+ var s = n[Symbol.asyncIterator]();
1211
+ A(e, t, function() {
1212
+ s.next().then(function(r) {
1213
+ r.done ? e.complete() : e.next(r.value);
1214
1214
  });
1215
1215
  }, 0, !0);
1216
1216
  });
1217
1217
  });
1218
1218
  }
1219
1219
  function kt(n, t) {
1220
- return qe(De(n), t);
1220
+ return Ke(Fe(n), t);
1221
1221
  }
1222
1222
  function Rt(n, t) {
1223
1223
  if (n != null) {
1224
- if (Ne(n))
1224
+ if (ke(n))
1225
1225
  return Lt(n, t);
1226
1226
  if (Ue(n))
1227
- return Mt(n, t);
1228
- if (Me(n))
1229
1227
  return Ut(n, t);
1230
- if (ke(n))
1231
- return qe(n, t);
1232
- if ($e(n))
1228
+ if (Ne(n))
1229
+ return Mt(n, t);
1230
+ if (Re(n))
1231
+ return Ke(n, t);
1232
+ if (De(n))
1233
1233
  return Nt(n, t);
1234
- if (Fe(n))
1234
+ if (He(n))
1235
1235
  return kt(n, t);
1236
1236
  }
1237
- throw Re(n);
1237
+ throw je(n);
1238
1238
  }
1239
- function ue(n, t) {
1240
- return t ? Rt(n, t) : M(n);
1239
+ function ce(n, t) {
1240
+ return t ? Rt(n, t) : U(n);
1241
1241
  }
1242
1242
  function jt() {
1243
1243
  for (var n = [], t = 0; t < arguments.length; t++)
1244
1244
  n[t] = arguments[t];
1245
- var e = Le(n);
1246
- return ue(n, e);
1245
+ var e = Me(n);
1246
+ return ce(n, e);
1247
1247
  }
1248
1248
  function $t(n) {
1249
1249
  return n instanceof Date && !isNaN(n);
1250
1250
  }
1251
1251
  function R(n, t) {
1252
- return P(function(e, r) {
1253
- var s = 0;
1254
- e.subscribe(A(r, function(o) {
1255
- r.next(n.call(t, o, s++));
1252
+ return P(function(e, s) {
1253
+ var r = 0;
1254
+ e.subscribe(O(s, function(o) {
1255
+ s.next(n.call(t, o, r++));
1256
1256
  }));
1257
1257
  });
1258
1258
  }
@@ -1266,16 +1266,16 @@ function Ht(n) {
1266
1266
  });
1267
1267
  }
1268
1268
  var Gt = Array.isArray, Bt = Object.getPrototypeOf, qt = Object.prototype, Kt = Object.keys;
1269
- function Yt(n) {
1269
+ function Vt(n) {
1270
1270
  if (n.length === 1) {
1271
1271
  var t = n[0];
1272
1272
  if (Gt(t))
1273
1273
  return { args: t, keys: null };
1274
- if (Wt(t)) {
1274
+ if (Yt(t)) {
1275
1275
  var e = Kt(t);
1276
1276
  return {
1277
- args: e.map(function(r) {
1278
- return t[r];
1277
+ args: e.map(function(s) {
1278
+ return t[s];
1279
1279
  }),
1280
1280
  keys: e
1281
1281
  };
@@ -1283,108 +1283,108 @@ function Yt(n) {
1283
1283
  }
1284
1284
  return { args: n, keys: null };
1285
1285
  }
1286
- function Wt(n) {
1286
+ function Yt(n) {
1287
1287
  return n && typeof n == "object" && Bt(n) === qt;
1288
1288
  }
1289
- function Xt(n, t) {
1290
- return n.reduce(function(e, r, s) {
1291
- return e[r] = t[s], e;
1289
+ function Wt(n, t) {
1290
+ return n.reduce(function(e, s, r) {
1291
+ return e[s] = t[r], e;
1292
1292
  }, {});
1293
1293
  }
1294
- function Vt() {
1294
+ function Xt() {
1295
1295
  for (var n = [], t = 0; t < arguments.length; t++)
1296
1296
  n[t] = arguments[t];
1297
- var e = Le(n), r = It(n), s = Yt(n), o = s.args, i = s.keys;
1297
+ var e = Me(n), s = Et(n), r = Vt(n), o = r.args, i = r.keys;
1298
1298
  if (o.length === 0)
1299
- return ue([], e);
1300
- var a = new y(zt(o, e, i ? function(u) {
1301
- return Xt(i, u);
1302
- } : W));
1303
- return r ? a.pipe(Ht(r)) : a;
1299
+ return ce([], e);
1300
+ var a = new y(zt(o, e, i ? function(c) {
1301
+ return Wt(i, c);
1302
+ } : Y));
1303
+ return s ? a.pipe(Ht(s)) : a;
1304
1304
  }
1305
1305
  function zt(n, t, e) {
1306
- return e === void 0 && (e = W), function(r) {
1306
+ return e === void 0 && (e = Y), function(s) {
1307
1307
  ge(t, function() {
1308
- for (var s = n.length, o = new Array(s), i = s, a = s, u = function(h) {
1308
+ for (var r = n.length, o = new Array(r), i = r, a = r, c = function(h) {
1309
1309
  ge(t, function() {
1310
- var m = ue(n[h], t), v = !1;
1311
- m.subscribe(A(r, function(d) {
1312
- o[h] = d, v || (v = !0, a--), a || r.next(e(o.slice()));
1310
+ var m = ce(n[h], t), v = !1;
1311
+ m.subscribe(O(s, function(d) {
1312
+ o[h] = d, v || (v = !0, a--), a || s.next(e(o.slice()));
1313
1313
  }, function() {
1314
- --i || r.complete();
1314
+ --i || s.complete();
1315
1315
  }));
1316
- }, r);
1317
- }, c = 0; c < s; c++)
1318
- u(c);
1319
- }, r);
1316
+ }, s);
1317
+ }, u = 0; u < r; u++)
1318
+ c(u);
1319
+ }, s);
1320
1320
  };
1321
1321
  }
1322
1322
  function ge(n, t, e) {
1323
- n ? O(e, n, t) : t();
1323
+ n ? A(e, n, t) : t();
1324
1324
  }
1325
- function Jt(n, t, e, r, s, o, i, a) {
1326
- var u = [], c = 0, h = 0, m = !1, v = function() {
1327
- m && !u.length && !c && t.complete();
1325
+ function Jt(n, t, e, s, r, o, i, a) {
1326
+ var c = [], u = 0, h = 0, m = !1, v = function() {
1327
+ m && !c.length && !u && t.complete();
1328
1328
  }, d = function(f) {
1329
- return c < r ? p(f) : u.push(f);
1329
+ return u < s ? p(f) : c.push(f);
1330
1330
  }, p = function(f) {
1331
- c++;
1331
+ u++;
1332
1332
  var _ = !1;
1333
- M(e(f, h++)).subscribe(A(t, function(E) {
1334
- t.next(E);
1333
+ U(e(f, h++)).subscribe(O(t, function(I) {
1334
+ t.next(I);
1335
1335
  }, function() {
1336
1336
  _ = !0;
1337
1337
  }, void 0, function() {
1338
1338
  if (_)
1339
1339
  try {
1340
- c--;
1341
- for (var E = function() {
1342
- var L = u.shift();
1340
+ u--;
1341
+ for (var I = function() {
1342
+ var L = c.shift();
1343
1343
  i || p(L);
1344
- }; u.length && c < r; )
1345
- E();
1344
+ }; c.length && u < s; )
1345
+ I();
1346
1346
  v();
1347
1347
  } catch (L) {
1348
1348
  t.error(L);
1349
1349
  }
1350
1350
  }));
1351
1351
  };
1352
- return n.subscribe(A(t, d, function() {
1352
+ return n.subscribe(O(t, d, function() {
1353
1353
  m = !0, v();
1354
1354
  })), function() {
1355
1355
  };
1356
1356
  }
1357
- function Y(n, t, e) {
1358
- return e === void 0 && (e = 1 / 0), g(t) ? Y(function(r, s) {
1357
+ function V(n, t, e) {
1358
+ return e === void 0 && (e = 1 / 0), b(t) ? V(function(s, r) {
1359
1359
  return R(function(o, i) {
1360
- return t(r, o, s, i);
1361
- })(M(n(r, s)));
1362
- }, e) : (typeof t == "number" && (e = t), P(function(r, s) {
1363
- return Jt(r, s, n, e);
1360
+ return t(s, o, r, i);
1361
+ })(U(n(s, r)));
1362
+ }, e) : (typeof t == "number" && (e = t), P(function(s, r) {
1363
+ return Jt(s, r, n, e);
1364
1364
  }));
1365
1365
  }
1366
1366
  function Qt(n, t, e) {
1367
1367
  n === void 0 && (n = 0), e === void 0 && (e = wt);
1368
- var r = -1;
1369
- return t != null && (Pe(t) ? e = t : r = t), new y(function(s) {
1368
+ var s = -1;
1369
+ return t != null && (_e(t) ? e = t : s = t), new y(function(r) {
1370
1370
  var o = $t(n) ? +n - e.now() : n;
1371
1371
  o < 0 && (o = 0);
1372
1372
  var i = 0;
1373
1373
  return e.schedule(function() {
1374
- s.closed || (s.next(i++), 0 <= r ? this.schedule(void 0, r) : s.complete());
1374
+ r.closed || (r.next(i++), 0 <= s ? this.schedule(void 0, s) : r.complete());
1375
1375
  }, o);
1376
1376
  });
1377
1377
  }
1378
1378
  function Zt(n, t) {
1379
- return g(t) ? Y(n, t, 1) : Y(n, 1);
1379
+ return b(t) ? V(n, t, 1) : V(n, 1);
1380
1380
  }
1381
1381
  function en(n) {
1382
1382
  return n <= 0 ? function() {
1383
- return Et;
1383
+ return It;
1384
1384
  } : P(function(t, e) {
1385
- var r = 0;
1386
- t.subscribe(A(e, function(s) {
1387
- ++r <= n && (e.next(s), n <= r && e.complete());
1385
+ var s = 0;
1386
+ t.subscribe(O(e, function(r) {
1387
+ ++s <= n && (e.next(r), n <= s && e.complete());
1388
1388
  }));
1389
1389
  });
1390
1390
  }
@@ -1394,27 +1394,27 @@ function tn(n) {
1394
1394
  });
1395
1395
  }
1396
1396
  function nn(n, t) {
1397
- return Y(function(e, r) {
1398
- return M(n(e, r)).pipe(en(1), tn(e));
1397
+ return V(function(e, s) {
1398
+ return U(n(e, s)).pipe(en(1), tn(e));
1399
1399
  });
1400
1400
  }
1401
- function rn(n, t) {
1402
- t === void 0 && (t = Ae);
1401
+ function sn(n, t) {
1402
+ t === void 0 && (t = Pe);
1403
1403
  var e = Qt(n, t);
1404
1404
  return nn(function() {
1405
1405
  return e;
1406
1406
  });
1407
1407
  }
1408
- function U(n, t) {
1409
- return t === void 0 && (t = W), n = n ?? sn, P(function(e, r) {
1410
- var s, o = !0;
1411
- e.subscribe(A(r, function(i) {
1408
+ function M(n, t) {
1409
+ return t === void 0 && (t = Y), n = n ?? rn, P(function(e, s) {
1410
+ var r, o = !0;
1411
+ e.subscribe(O(s, function(i) {
1412
1412
  var a = t(i);
1413
- (o || !n(s, a)) && (o = !1, s = a, r.next(i));
1413
+ (o || !n(r, a)) && (o = !1, r = a, s.next(i));
1414
1414
  }));
1415
1415
  });
1416
1416
  }
1417
- function sn(n, t) {
1417
+ function rn(n, t) {
1418
1418
  return n === t;
1419
1419
  }
1420
1420
  function on(n) {
@@ -1428,27 +1428,27 @@ function on(n) {
1428
1428
  }
1429
1429
  function an(n) {
1430
1430
  return P(function(t, e) {
1431
- M(n).subscribe(A(e, function() {
1431
+ U(n).subscribe(O(e, function() {
1432
1432
  return e.complete();
1433
- }, re)), !e.closed && t.subscribe(e);
1433
+ }, se)), !e.closed && t.subscribe(e);
1434
1434
  });
1435
1435
  }
1436
1436
  function be(n) {
1437
- const { endpoint: t, apiKey: e, payload: r, debugMode: s, customHeaders: o } = n, i = n.method ?? "POST";
1437
+ const { endpoint: t, apiKey: e, payload: s, debugMode: r, customHeaders: o } = n, i = n.method ?? "POST";
1438
1438
  return new y((a) => {
1439
- const u = new AbortController();
1440
- let c, h = !1, m = !1;
1439
+ const c = new AbortController();
1440
+ let u, h = !1, m = !1;
1441
1441
  const v = {
1442
1442
  "Content-Type": "application/json",
1443
1443
  ...o
1444
1444
  };
1445
1445
  e && (v["X-API-KEY"] = e);
1446
1446
  const d = new URL(t);
1447
- return s && d.searchParams.set("is_debug", "true"), Ee(d.toString(), {
1447
+ return r && d.searchParams.set("is_debug", "true"), Ee(d.toString(), {
1448
1448
  method: i,
1449
1449
  headers: v,
1450
- body: i === "POST" && r ? JSON.stringify(r) : void 0,
1451
- signal: u.signal,
1450
+ body: i === "POST" && s ? JSON.stringify(s) : void 0,
1451
+ signal: c.signal,
1452
1452
  /**
1453
1453
  * Allow SSE to work when the page is hidden.
1454
1454
  * https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
@@ -1456,7 +1456,7 @@ function be(n) {
1456
1456
  openWhenHidden: !0,
1457
1457
  onopen: async (p) => {
1458
1458
  if (p.ok)
1459
- c = p.headers.get("X-Trace-Id") ?? void 0;
1459
+ u = p.headers.get("X-Trace-Id") ?? void 0;
1460
1460
  else {
1461
1461
  let f;
1462
1462
  try {
@@ -1468,13 +1468,13 @@ function be(n) {
1468
1468
  f = null;
1469
1469
  }
1470
1470
  }
1471
- a.error(new w(p.status, p.statusText, f)), u.abort();
1471
+ a.error(new w(p.status, p.statusText, f)), c.abort();
1472
1472
  }
1473
1473
  },
1474
1474
  onmessage: (p) => {
1475
1475
  p.id && (h = !0);
1476
1476
  const f = JSON.parse(p.data);
1477
- c ? f.traceId = c : f.requestId && (f.traceId = f.requestId, c || (c = f.requestId)), a.next(f);
1477
+ u ? f.traceId = u : f.requestId && (f.traceId = f.requestId, u || (u = f.requestId)), a.next(f);
1478
1478
  },
1479
1479
  onclose: () => {
1480
1480
  a.complete();
@@ -1482,14 +1482,14 @@ function be(n) {
1482
1482
  onerror: (p) => {
1483
1483
  if (m) throw p;
1484
1484
  if (!h)
1485
- throw a.error(p), u.abort(), p;
1485
+ throw a.error(p), c.abort(), p;
1486
1486
  }
1487
1487
  }), () => {
1488
- m = !0, u.abort();
1488
+ m = !0, c.abort();
1489
1489
  };
1490
1490
  });
1491
1491
  }
1492
- class un {
1492
+ class cn {
1493
1493
  listeners = {};
1494
1494
  on(t, e) {
1495
1495
  this.listeners = Object.assign({}, this.listeners, {
@@ -1498,17 +1498,17 @@ class un {
1498
1498
  }
1499
1499
  off(t, e) {
1500
1500
  this.listeners[t] && (this.listeners = Object.assign({}, this.listeners, {
1501
- [t]: (this.listeners[t] ?? []).filter((r) => r !== e)
1501
+ [t]: (this.listeners[t] ?? []).filter((s) => s !== e)
1502
1502
  }));
1503
1503
  }
1504
1504
  remove(t) {
1505
1505
  delete this.listeners[t];
1506
1506
  }
1507
1507
  emit(t, ...e) {
1508
- this.listeners[t] && this.listeners[t].forEach((r) => r(...e));
1508
+ this.listeners[t] && this.listeners[t].forEach((s) => s(...e));
1509
1509
  }
1510
1510
  }
1511
- class Mn {
1511
+ class Un {
1512
1512
  apiKey;
1513
1513
  endpoint;
1514
1514
  botProviderEndpoint;
@@ -1518,7 +1518,7 @@ class Mn {
1518
1518
  detached = !1;
1519
1519
  detachTimer;
1520
1520
  inFlight = 0;
1521
- sseEmitter = new un();
1521
+ sseEmitter = new cn();
1522
1522
  transformSsePayload;
1523
1523
  customHeaders;
1524
1524
  constructor(t) {
@@ -1588,11 +1588,11 @@ class Mn {
1588
1588
  */
1589
1589
  rejoinSse(t, e) {
1590
1590
  e?.onSseStart?.(), this.inFlight += 1;
1591
- const r = new URL(this.endpoint);
1592
- return r.searchParams.set("custom_channel_id", t), this.runSse(
1591
+ const s = new URL(this.endpoint);
1592
+ return s.searchParams.set("custom_channel_id", t), this.runSse(
1593
1593
  be({
1594
1594
  apiKey: this.apiKey,
1595
- endpoint: r.toString(),
1595
+ endpoint: s.toString(),
1596
1596
  debugMode: this.debugMode,
1597
1597
  method: "GET",
1598
1598
  customHeaders: this.customHeaders
@@ -1614,11 +1614,11 @@ class Mn {
1614
1614
  const e = this.deriveChannelMetadataEndpoint();
1615
1615
  if (!e)
1616
1616
  throw new Error("Unable to derive channel metadata endpoint. Please provide botProviderEndpoint in config.");
1617
- const r = new URL(e);
1618
- r.searchParams.set("custom_channel_id", t);
1619
- const s = { ...this.customHeaders };
1620
- this.apiKey && (s["X-API-KEY"] = this.apiKey);
1621
- const o = await fetch(r.toString(), { method: "GET", headers: s });
1617
+ const s = new URL(e);
1618
+ s.searchParams.set("custom_channel_id", t);
1619
+ const r = { ...this.customHeaders };
1620
+ this.apiKey && (r["X-API-KEY"] = this.apiKey);
1621
+ const o = await fetch(s.toString(), { method: "GET", headers: r });
1622
1622
  if (o.status === 404)
1623
1623
  return null;
1624
1624
  if (!o.ok)
@@ -1631,12 +1631,12 @@ class Mn {
1631
1631
  lastActivityAt: a.lastActivityAt,
1632
1632
  // F-019 — whitelist-pass the live-sandbox list (map the five backend fields); `[]` for an old
1633
1633
  // backend / a channel with none live. metadata is the sole authority on "who is live".
1634
- launchedSandboxes: (a.launchedSandboxes ?? []).map((u) => ({
1635
- sandboxName: u.sandboxName,
1636
- sandboxBlueprintName: u.sandboxBlueprintName,
1637
- workingDirectory: u.workingDirectory,
1638
- editorServerEnabled: u.editorServerEnabled,
1639
- browserEnabled: u.browserEnabled
1634
+ launchedSandboxes: (a.launchedSandboxes ?? []).map((c) => ({
1635
+ sandboxName: c.sandboxName,
1636
+ sandboxBlueprintName: c.sandboxBlueprintName,
1637
+ workingDirectory: c.workingDirectory,
1638
+ editorServerEnabled: c.editorServerEnabled,
1639
+ browserEnabled: c.browserEnabled
1640
1640
  }))
1641
1641
  };
1642
1642
  }
@@ -1661,12 +1661,12 @@ class Mn {
1661
1661
  * stop, which is a success rather than an error. Every other non-2xx throws {@link HttpError}.
1662
1662
  */
1663
1663
  async suspendChannel(t, e) {
1664
- const r = this.deriveSuspendEndpoint();
1665
- if (!r)
1664
+ const s = this.deriveSuspendEndpoint();
1665
+ if (!s)
1666
1666
  throw new Error("Unable to derive channel suspend endpoint. Please provide botProviderEndpoint in config.");
1667
- const s = new URL(r);
1668
- s.searchParams.set("custom_channel_id", t), e?.requestId && s.searchParams.set("request_id", e.requestId), e?.force && s.searchParams.set("force", "true");
1669
- const o = await fetch(s.toString(), { method: "POST", headers: this.apiHeaders() });
1667
+ const r = new URL(s);
1668
+ r.searchParams.set("custom_channel_id", t), e?.requestId && r.searchParams.set("request_id", e.requestId), e?.force && r.searchParams.set("force", "true");
1669
+ const o = await fetch(r.toString(), { method: "POST", headers: this.apiHeaders() });
1670
1670
  if (!(o.ok || o.status === 404))
1671
1671
  throw new w(o.status, o.statusText, await o.text().catch(() => {
1672
1672
  }));
@@ -1676,17 +1676,17 @@ class Mn {
1676
1676
  // No RxJS-level retry: re-subscribing would re-POST and the backend would re-dispatch a duplicate
1677
1677
  // run. Mid-stream resume is the library's job (native Last-Event-ID reconnect in
1678
1678
  // create-sse-observable); a no-cursor failure surfaces via `error` below.
1679
- Zt((r) => jt(r).pipe(rn(e?.delayTime ?? 50))),
1679
+ Zt((s) => jt(s).pipe(sn(e?.delayTime ?? 50))),
1680
1680
  an(this.destroy$),
1681
1681
  // Settle the run accounting on every termination path — complete, error, AND a user-initiated
1682
1682
  // unsubscribe (stop-generation aborts the connection without a terminal event).
1683
1683
  on(() => this.onRunSettled())
1684
1684
  ).subscribe({
1685
- next: (r) => {
1686
- this.detached || (e?.onSseMessage?.(r), this.handleEvent(r));
1685
+ next: (s) => {
1686
+ this.detached || (e?.onSseMessage?.(s), this.handleEvent(s));
1687
1687
  },
1688
- error: (r) => {
1689
- this.detached || e?.onSseError?.(r);
1688
+ error: (s) => {
1689
+ this.detached || e?.onSseError?.(s);
1690
1690
  },
1691
1691
  complete: () => {
1692
1692
  this.detached || e?.onSseCompleted?.();
@@ -1727,20 +1727,20 @@ class Mn {
1727
1727
  * 根據 API 文件:/ns/{namespace}/bot-provider/{bot_provider_name}/blob
1728
1728
  */
1729
1729
  async uploadFile(t, e) {
1730
- const r = this.deriveBlobEndpoint();
1731
- if (!r)
1730
+ const s = this.deriveBlobEndpoint();
1731
+ if (!s)
1732
1732
  throw new Error("Unable to derive blob endpoint. Please provide botProviderEndpoint in config.");
1733
- const s = new FormData();
1734
- s.append("file", t), s.append("customChannelId", e);
1733
+ const r = new FormData();
1734
+ r.append("file", t), r.append("customChannelId", e);
1735
1735
  const o = {
1736
1736
  ...this.customHeaders
1737
1737
  };
1738
1738
  this.apiKey && (o["X-API-KEY"] = this.apiKey);
1739
1739
  try {
1740
- const i = await fetch(r, {
1740
+ const i = await fetch(s, {
1741
1741
  method: "POST",
1742
1742
  headers: o,
1743
- body: s
1743
+ body: r
1744
1744
  });
1745
1745
  if (!i.ok)
1746
1746
  throw new Error(`Upload failed: ${i.status} ${i.statusText}`);
@@ -1755,10 +1755,10 @@ class Mn {
1755
1755
  * 呼叫 Edge Server GET <base>/channel-home/download?custom_channel_id=xxx&relative_path=xxx 取回 binary。
1756
1756
  */
1757
1757
  async downloadChannelHomeFile(t, e) {
1758
- const r = this.getBaseEndpoint();
1759
- if (!r)
1758
+ const s = this.getBaseEndpoint();
1759
+ if (!s)
1760
1760
  throw new Error("Unable to derive channel-home download endpoint. Please provide botProviderEndpoint in config.");
1761
- const s = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, o = `${r}/channel-home/download?${s}`, i = {
1761
+ const r = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, o = `${s}/channel-home/download?${r}`, i = {
1762
1762
  ...this.customHeaders
1763
1763
  };
1764
1764
  this.apiKey && (i["X-API-KEY"] = this.apiKey);
@@ -1769,8 +1769,8 @@ class Mn {
1769
1769
  });
1770
1770
  if (!a.ok)
1771
1771
  throw new Error(`Channel Home download failed: ${a.status} ${a.statusText}`);
1772
- const u = await a.blob(), c = t.split("/").pop() || "download";
1773
- return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: c, size: u.size }), { blob: u, filename: c };
1772
+ const c = await a.blob(), u = t.split("/").pop() || "download";
1773
+ return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: u, size: c.size }), { blob: c, filename: u };
1774
1774
  } catch (a) {
1775
1775
  throw console.error("[AsgardServiceClient] Channel Home download error:", a), a;
1776
1776
  }
@@ -1787,9 +1787,9 @@ class Mn {
1787
1787
  throw new Error(
1788
1788
  "Unable to derive sandbox browser open-url endpoint. Please provide botProviderEndpoint in config."
1789
1789
  );
1790
- const r = `${e}/sandbox/${encodeURIComponent(t)}/browser/open-url`, s = { ...this.customHeaders };
1791
- this.apiKey && (s["X-API-KEY"] = this.apiKey);
1792
- const o = await fetch(r, { method: "POST", headers: s });
1790
+ const s = `${e}/sandbox/${encodeURIComponent(t)}/browser/open-url`, r = { ...this.customHeaders };
1791
+ this.apiKey && (r["X-API-KEY"] = this.apiKey);
1792
+ const o = await fetch(s, { method: "POST", headers: r });
1793
1793
  if (!o.ok)
1794
1794
  throw new w(o.status, o.statusText, await o.text().catch(() => {
1795
1795
  }));
@@ -1817,23 +1817,23 @@ class Mn {
1817
1817
  * 容錯,比照 `channelMetadata`)。
1818
1818
  */
1819
1819
  async sandboxFsList(t, e) {
1820
- const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/list`);
1821
- r.searchParams.set("path", e);
1822
- const s = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
1823
- if (!s.ok)
1824
- throw new w(s.status, s.statusText, await s.text().catch(() => {
1820
+ const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/list`);
1821
+ s.searchParams.set("path", e);
1822
+ const r = await fetch(s.toString(), { method: "GET", headers: this.apiHeaders() });
1823
+ if (!r.ok)
1824
+ throw new w(r.status, r.statusText, await r.text().catch(() => {
1825
1825
  }));
1826
- const o = await s.json(), i = o.data ?? o;
1826
+ const o = await r.json(), i = o.data ?? o;
1827
1827
  return { entries: i.entries ?? [], truncated: i.truncated ?? !1 };
1828
1828
  }
1829
1829
  /**
1830
1830
  * F-021 — 讀取 sandbox 檔案(`GET fs/file?path=[&offset_bytes&limit_bytes]`)。回應是 raw octet-stream,
1831
1831
  * 檔案總長度 / 是否截斷走 `X-Total-Bytes` / `X-Truncated` header。
1832
1832
  */
1833
- async sandboxFsRead(t, e, r) {
1834
- const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
1835
- 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));
1836
- const o = await fetch(s.toString(), { method: "GET", headers: this.apiHeaders() });
1833
+ async sandboxFsRead(t, e, s) {
1834
+ const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
1835
+ r.searchParams.set("path", e), s?.offsetBytes != null && r.searchParams.set("offset_bytes", String(s.offsetBytes)), s?.limitBytes != null && r.searchParams.set("limit_bytes", String(s.limitBytes));
1836
+ const o = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
1837
1837
  if (!o.ok)
1838
1838
  throw new w(o.status, o.statusText, await o.text().catch(() => {
1839
1839
  }));
@@ -1848,23 +1848,23 @@ class Mn {
1848
1848
  * F-021 — 寫入 sandbox 檔案(`PUT fs/file?path=[&mode&create_only]`,`multipart/form-data` 帶 `file`)。
1849
1849
  * 回應 `{ data: { bytesWritten } }`。
1850
1850
  */
1851
- async sandboxFsWrite(t, e, r, s) {
1851
+ async sandboxFsWrite(t, e, s, r) {
1852
1852
  const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
1853
- o.searchParams.set("path", e), s?.mode != null && o.searchParams.set("mode", String(s.mode)), s?.createOnly && o.searchParams.set("create_only", "true");
1853
+ o.searchParams.set("path", e), r?.mode != null && o.searchParams.set("mode", String(r.mode)), r?.createOnly && o.searchParams.set("create_only", "true");
1854
1854
  const i = new FormData();
1855
- i.append("file", r instanceof Blob ? r : new Blob([r]));
1855
+ i.append("file", s instanceof Blob ? s : new Blob([s]));
1856
1856
  const a = await fetch(o.toString(), { method: "PUT", headers: this.apiHeaders(), body: i });
1857
1857
  if (!a.ok)
1858
1858
  throw new w(a.status, a.statusText, await a.text().catch(() => {
1859
1859
  }));
1860
- const u = await a.json();
1861
- return { bytesWritten: (u.data ?? u).bytesWritten ?? 0 };
1860
+ const c = await a.json();
1861
+ return { bytesWritten: (c.data ?? c).bytesWritten ?? 0 };
1862
1862
  }
1863
1863
  /** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
1864
- async sandboxFsRequest(t, e, r, s) {
1864
+ async sandboxFsRequest(t, e, s, r) {
1865
1865
  const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`);
1866
- Object.entries(s).forEach(([a, u]) => o.searchParams.set(a, u));
1867
- const i = await fetch(o.toString(), { method: r, headers: this.apiHeaders() });
1866
+ Object.entries(r).forEach(([a, c]) => o.searchParams.set(a, c));
1867
+ const i = await fetch(o.toString(), { method: s, headers: this.apiHeaders() });
1868
1868
  if (!i.ok)
1869
1869
  throw new w(i.status, i.statusText, await i.text().catch(() => {
1870
1870
  }));
@@ -1872,13 +1872,13 @@ class Mn {
1872
1872
  }
1873
1873
  /** F-021 — stat a sandbox path (`GET fs/stat?path=`). */
1874
1874
  async sandboxFsStat(t, e) {
1875
- const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/stat`);
1876
- r.searchParams.set("path", e);
1877
- const s = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
1878
- if (!s.ok)
1879
- throw new w(s.status, s.statusText, await s.text().catch(() => {
1875
+ const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/stat`);
1876
+ s.searchParams.set("path", e);
1877
+ const r = await fetch(s.toString(), { method: "GET", headers: this.apiHeaders() });
1878
+ if (!r.ok)
1879
+ throw new w(r.status, r.statusText, await r.text().catch(() => {
1880
1880
  }));
1881
- const o = await s.json(), i = o.data ?? o;
1881
+ const o = await r.json(), i = o.data ?? o;
1882
1882
  return {
1883
1883
  exists: i.exists ?? !1,
1884
1884
  isDir: i.isDir ?? !1,
@@ -1901,16 +1901,16 @@ class Mn {
1901
1901
  await this.sandboxFsRequest(t, "all", "DELETE", { path: e });
1902
1902
  }
1903
1903
  /** F-021 — copy a path (`POST fs/copy?src=&dst=[&overwrite]`) → bytes copied. */
1904
- async sandboxFsCopy(t, e, r, s) {
1905
- const o = { src: e, dst: r };
1906
- s?.overwrite && (o.overwrite = "true");
1904
+ async sandboxFsCopy(t, e, s, r) {
1905
+ const o = { src: e, dst: s };
1906
+ r?.overwrite && (o.overwrite = "true");
1907
1907
  const i = await this.sandboxFsRequest(t, "copy", "POST", o);
1908
1908
  return { bytesCopied: (i?.data ?? i)?.bytesCopied ?? 0 };
1909
1909
  }
1910
1910
  /** F-021 — move / rename a path (`POST fs/move?src=&dst=[&overwrite]`). */
1911
- async sandboxFsMove(t, e, r, s) {
1912
- const o = { src: e, dst: r };
1913
- s?.overwrite && (o.overwrite = "true"), await this.sandboxFsRequest(t, "move", "POST", o);
1911
+ async sandboxFsMove(t, e, s, r) {
1912
+ const o = { src: e, dst: s };
1913
+ r?.overwrite && (o.overwrite = "true"), await this.sandboxFsRequest(t, "move", "POST", o);
1914
1914
  }
1915
1915
  /**
1916
1916
  * F-021 — watch a sandbox path for changes (`GET fs/watch?path=`, SSE). Each `event: change` frame is one
@@ -1918,10 +1918,10 @@ class Mn {
1918
1918
  * as a dead stream. Unsubscribing aborts the request, which ends the sandbox-side watcher.
1919
1919
  */
1920
1920
  sandboxFsWatch(t, e) {
1921
- const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/watch`);
1922
- return r.searchParams.set("path", e), new y((s) => {
1921
+ const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/watch`);
1922
+ return s.searchParams.set("path", e), new y((r) => {
1923
1923
  const o = new AbortController();
1924
- return Ee(r.toString(), {
1924
+ return Ee(s.toString(), {
1925
1925
  headers: this.apiHeaders(),
1926
1926
  signal: o.signal,
1927
1927
  openWhenHidden: !0,
@@ -1929,15 +1929,15 @@ class Mn {
1929
1929
  if (!i.ok) {
1930
1930
  const a = await i.text().catch(() => {
1931
1931
  });
1932
- s.error(new w(i.status, i.statusText, a)), o.abort();
1932
+ r.error(new w(i.status, i.statusText, a)), o.abort();
1933
1933
  }
1934
1934
  },
1935
1935
  onmessage: (i) => {
1936
- i.event === "change" && s.next(JSON.parse(i.data));
1936
+ i.event === "change" && r.next(JSON.parse(i.data));
1937
1937
  },
1938
- onclose: () => s.complete(),
1938
+ onclose: () => r.complete(),
1939
1939
  onerror: (i) => {
1940
- throw s.error(i), o.abort(), i;
1940
+ throw r.error(i), o.abort(), i;
1941
1941
  }
1942
1942
  }), () => o.abort();
1943
1943
  });
@@ -1961,7 +1961,7 @@ class Mn {
1961
1961
  const S = [];
1962
1962
  for (let n = 0; n < 256; ++n)
1963
1963
  S.push((n + 256).toString(16).slice(1));
1964
- function cn(n, t = 0) {
1964
+ function un(n, t = 0) {
1965
1965
  return (S[n[t + 0]] + S[n[t + 1]] + S[n[t + 2]] + S[n[t + 3]] + "-" + S[n[t + 4]] + S[n[t + 5]] + "-" + S[n[t + 6]] + S[n[t + 7]] + "-" + S[n[t + 8]] + S[n[t + 9]] + "-" + S[n[t + 10]] + S[n[t + 11]] + S[n[t + 12]] + S[n[t + 13]] + S[n[t + 14]] + S[n[t + 15]]).toLowerCase();
1966
1966
  }
1967
1967
  let J;
@@ -1977,15 +1977,15 @@ function dn() {
1977
1977
  const hn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ve = { randomUUID: hn };
1978
1978
  function fn(n, t, e) {
1979
1979
  n = n || {};
1980
- const r = n.random ?? n.rng?.() ?? dn();
1981
- if (r.length < 16)
1980
+ const s = n.random ?? n.rng?.() ?? dn();
1981
+ if (s.length < 16)
1982
1982
  throw new Error("Random bytes length must be >= 16");
1983
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, cn(r);
1983
+ return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, un(s);
1984
1984
  }
1985
- function Ke(n, t, e) {
1985
+ function Ve(n, t, e) {
1986
1986
  return ve.randomUUID && !n ? ve.randomUUID() : fn(n);
1987
1987
  }
1988
- class b {
1988
+ class g {
1989
1989
  messages = null;
1990
1990
  pendingConsent = null;
1991
1991
  constructor({ messages: t, pendingConsent: e = null }) {
@@ -1993,10 +1993,10 @@ class b {
1993
1993
  }
1994
1994
  pushMessage(t) {
1995
1995
  const e = new Map(this.messages);
1996
- return e.set(t.messageId, t), new b({ messages: e, pendingConsent: this.pendingConsent });
1996
+ return e.set(t.messageId, t), new g({ messages: e, pendingConsent: this.pendingConsent });
1997
1997
  }
1998
1998
  clearPendingConsent() {
1999
- return this.pendingConsent ? new b({ messages: this.messages, pendingConsent: null }) : this;
1999
+ return this.pendingConsent ? new g({ messages: this.messages, pendingConsent: null }) : this;
2000
2000
  }
2001
2001
  /**
2002
2002
  * Put a consent prompt back (#410) — the mirror of {@link clearPendingConsent}, used to undo the
@@ -2004,7 +2004,7 @@ class b {
2004
2004
  * meantime: that one is newer than the batch being restored.
2005
2005
  */
2006
2006
  restorePendingConsent(t) {
2007
- return this.pendingConsent ? this : new b({ messages: this.messages, pendingConsent: t });
2007
+ return this.pendingConsent ? this : new g({ messages: this.messages, pendingConsent: t });
2008
2008
  }
2009
2009
  /**
2010
2010
  * Converge everything the aborted run left mid-flight (F-020 AC10, F-023). A stopped run sends no
@@ -2023,9 +2023,9 @@ class b {
2023
2023
  if (!this.messages) return this;
2024
2024
  let t = !1;
2025
2025
  const e = new Map(this.messages);
2026
- for (const [r, s] of e)
2027
- s.type === "tool-call" && !s.isComplete && (e.set(r, { ...s, isComplete: !0, isCancelled: !0 }), t = !0), s.type === "thinking" && s.isThinking && (e.set(r, { ...s, isThinking: !1 }), t = !0);
2028
- return t ? new b({ messages: e, pendingConsent: this.pendingConsent }) : this;
2026
+ for (const [s, r] of e)
2027
+ r.type === "tool-call" && !r.isComplete && (e.set(s, { ...r, isComplete: !0, isCancelled: !0 }), t = !0), r.type === "thinking" && r.isThinking && (e.set(s, { ...r, isThinking: !1 }), t = !0);
2028
+ return t ? new g({ messages: e, pendingConsent: this.pendingConsent }) : this;
2029
2029
  }
2030
2030
  /**
2031
2031
  * @deprecated Renamed to {@link settleInFlightMessages} in 0.3.27 — it settles in-flight thinking
@@ -2051,6 +2051,12 @@ class b {
2051
2051
  return this.onThinkingDelta(t);
2052
2052
  case l.MESSAGE_THINKING_COMPLETE:
2053
2053
  return this.onThinkingComplete(t);
2054
+ case l.MESSAGE_CANVAS_START:
2055
+ return this.onCanvasStart(t);
2056
+ case l.MESSAGE_CANVAS_DELTA:
2057
+ return this.onCanvasDelta(t);
2058
+ case l.MESSAGE_CANVAS_COMPLETE:
2059
+ return this.onCanvasComplete(t);
2054
2060
  case l.TOOL_CALL_START:
2055
2061
  return this.onToolCallStart(t);
2056
2062
  case l.TOOL_CALL_COMPLETE:
@@ -2092,12 +2098,20 @@ class b {
2092
2098
  isTerminalToolCall(t) {
2093
2099
  return t?.type === "tool-call" && t.isComplete === !0;
2094
2100
  }
2101
+ /**
2102
+ * A canvas is terminal once `canvas.complete` has delivered the authoritative fragment
2103
+ * (`isDrawing === false`). Same policy as the bot / thinking guards (F-011): a late start or delta
2104
+ * must not swap that fragment back to whatever prefix happened to be in flight.
2105
+ */
2106
+ isTerminalCanvas(t) {
2107
+ return t?.type === "canvas" && !t.isDrawing;
2108
+ }
2095
2109
  onMessageStart(t) {
2096
2110
  const e = t.fact.messageStart.message;
2097
2111
  if (e.parentToolUseId) return this;
2098
2112
  if (this.isTerminalBot(this.messages?.get(e.messageId))) return this;
2099
- const r = new Map(this.messages);
2100
- return r.set(e.messageId, {
2113
+ const s = new Map(this.messages);
2114
+ return s.set(e.messageId, {
2101
2115
  type: "bot",
2102
2116
  eventType: l.MESSAGE_START,
2103
2117
  isTyping: !0,
@@ -2107,31 +2121,31 @@ class b {
2107
2121
  time: /* @__PURE__ */ new Date(),
2108
2122
  traceId: t.traceId,
2109
2123
  raw: ""
2110
- }), new b({ messages: r, pendingConsent: this.pendingConsent });
2124
+ }), new g({ messages: s, pendingConsent: this.pendingConsent });
2111
2125
  }
2112
2126
  onMessageDelta(t) {
2113
2127
  const e = t.fact.messageDelta.message;
2114
2128
  if (e.parentToolUseId) return this;
2115
- const r = this.messages?.get(e.messageId);
2116
- if (this.isTerminalBot(r)) return this;
2117
- const s = r?.type === "bot" ? r : void 0, o = new Map(this.messages);
2129
+ const s = this.messages?.get(e.messageId);
2130
+ if (this.isTerminalBot(s)) return this;
2131
+ const r = s?.type === "bot" ? s : void 0, o = new Map(this.messages);
2118
2132
  return o.set(e.messageId, {
2119
2133
  type: "bot",
2120
2134
  eventType: l.MESSAGE_DELTA,
2121
2135
  isTyping: !0,
2122
- typingText: `${s?.typingText ?? ""}${e.text}`,
2136
+ typingText: `${r?.typingText ?? ""}${e.text}`,
2123
2137
  messageId: e.messageId,
2124
2138
  message: e,
2125
2139
  time: /* @__PURE__ */ new Date(),
2126
- traceId: t.traceId ?? s?.traceId,
2127
- raw: s?.raw ?? ""
2128
- }), new b({ messages: o, pendingConsent: this.pendingConsent });
2140
+ traceId: t.traceId ?? r?.traceId,
2141
+ raw: r?.raw ?? ""
2142
+ }), new g({ messages: o, pendingConsent: this.pendingConsent });
2129
2143
  }
2130
2144
  onMessageComplete(t) {
2131
2145
  const e = t.fact.messageComplete.message;
2132
2146
  if (e.parentToolUseId) return this;
2133
- const r = new Map(this.messages), s = r.get(e.messageId);
2134
- return r.set(e.messageId, {
2147
+ const s = new Map(this.messages), r = s.get(e.messageId);
2148
+ return s.set(e.messageId, {
2135
2149
  type: "bot",
2136
2150
  eventType: l.MESSAGE_COMPLETE,
2137
2151
  isTyping: !1,
@@ -2139,15 +2153,15 @@ class b {
2139
2153
  messageId: e.messageId,
2140
2154
  message: e,
2141
2155
  time: /* @__PURE__ */ new Date(),
2142
- traceId: t.traceId ?? (s?.type === "bot" ? s.traceId : void 0),
2156
+ traceId: t.traceId ?? (r?.type === "bot" ? r.traceId : void 0),
2143
2157
  raw: JSON.stringify(t)
2144
- }), new b({ messages: r, pendingConsent: this.pendingConsent });
2158
+ }), new g({ messages: s, pendingConsent: this.pendingConsent });
2145
2159
  }
2146
2160
  onThinkingStart(t) {
2147
2161
  const e = t.fact.messageThinkingStart.message;
2148
2162
  if (e.parentToolUseId) return this;
2149
2163
  if (this.isTerminalThinking(this.messages?.get(e.messageId))) return this;
2150
- const r = new Map(this.messages), s = {
2164
+ const s = new Map(this.messages), r = {
2151
2165
  type: "thinking",
2152
2166
  messageId: e.messageId,
2153
2167
  text: e.text,
@@ -2155,42 +2169,95 @@ class b {
2155
2169
  time: /* @__PURE__ */ new Date(),
2156
2170
  traceId: t.traceId
2157
2171
  };
2158
- return r.set(e.messageId, s), new b({ messages: r, pendingConsent: this.pendingConsent });
2172
+ return s.set(e.messageId, r), new g({ messages: s, pendingConsent: this.pendingConsent });
2159
2173
  }
2160
2174
  onThinkingDelta(t) {
2161
2175
  const e = t.fact.messageThinkingDelta.message;
2162
2176
  if (e.parentToolUseId) return this;
2163
- const r = this.messages?.get(e.messageId);
2164
- if (this.isTerminalThinking(r)) return this;
2165
- const s = r?.type === "thinking" ? r : void 0, o = new Map(this.messages), i = {
2177
+ const s = this.messages?.get(e.messageId);
2178
+ if (this.isTerminalThinking(s)) return this;
2179
+ const r = s?.type === "thinking" ? s : void 0, o = new Map(this.messages), i = {
2166
2180
  type: "thinking",
2167
2181
  messageId: e.messageId,
2168
- text: `${s?.text ?? ""}${e.text}`,
2182
+ text: `${r?.text ?? ""}${e.text}`,
2169
2183
  isThinking: !0,
2170
- time: s?.time ?? /* @__PURE__ */ new Date(),
2171
- traceId: t.traceId ?? s?.traceId
2184
+ time: r?.time ?? /* @__PURE__ */ new Date(),
2185
+ traceId: t.traceId ?? r?.traceId
2172
2186
  };
2173
- return o.set(e.messageId, i), new b({ messages: o, pendingConsent: this.pendingConsent });
2187
+ return o.set(e.messageId, i), new g({ messages: o, pendingConsent: this.pendingConsent });
2174
2188
  }
2175
2189
  onThinkingComplete(t) {
2176
2190
  const e = t.fact.messageThinkingComplete.message;
2177
2191
  if (e.parentToolUseId) return this;
2178
- const r = this.messages?.get(e.messageId), s = r?.type === "thinking" ? r : void 0, o = new Map(this.messages), i = {
2192
+ const s = this.messages?.get(e.messageId), r = s?.type === "thinking" ? s : void 0, o = new Map(this.messages), i = {
2179
2193
  type: "thinking",
2180
2194
  messageId: e.messageId,
2181
2195
  // Self-sufficient (F-011): the complete frame carries the full reasoning, so a complete-only
2182
2196
  // replay (no start/delta) still renders the whole text.
2183
2197
  text: e.text,
2184
2198
  isThinking: !1,
2185
- time: s?.time ?? /* @__PURE__ */ new Date(),
2186
- traceId: t.traceId ?? s?.traceId
2199
+ time: r?.time ?? /* @__PURE__ */ new Date(),
2200
+ traceId: t.traceId ?? r?.traceId
2201
+ };
2202
+ return o.set(e.messageId, i), new g({ messages: o, pendingConsent: this.pendingConsent });
2203
+ }
2204
+ onCanvasStart(t) {
2205
+ const e = t.fact.messageCanvasStart.message;
2206
+ if (e.parentToolUseId) return this;
2207
+ if (this.isTerminalCanvas(this.messages?.get(e.messageId))) return this;
2208
+ const s = new Map(this.messages), r = {
2209
+ type: "canvas",
2210
+ messageId: e.messageId,
2211
+ html: "",
2212
+ isDrawing: !0,
2213
+ time: /* @__PURE__ */ new Date(),
2214
+ traceId: t.traceId
2187
2215
  };
2188
- return o.set(e.messageId, i), new b({ messages: o, pendingConsent: this.pendingConsent });
2216
+ return s.set(e.messageId, r), new g({ messages: s, pendingConsent: this.pendingConsent });
2217
+ }
2218
+ onCanvasDelta(t) {
2219
+ const e = t.fact.messageCanvasDelta.message;
2220
+ if (e.parentToolUseId) return this;
2221
+ const s = this.messages?.get(e.messageId);
2222
+ if (this.isTerminalCanvas(s)) return this;
2223
+ const r = s?.type === "canvas" ? s : void 0, o = new Map(this.messages), i = {
2224
+ type: "canvas",
2225
+ messageId: e.messageId,
2226
+ // Deltas are incremental, exactly like a text delta.
2227
+ html: `${r?.html ?? ""}${e.text}`,
2228
+ title: r?.title,
2229
+ isDrawing: !0,
2230
+ time: r?.time ?? /* @__PURE__ */ new Date(),
2231
+ traceId: t.traceId ?? r?.traceId
2232
+ };
2233
+ return o.set(e.messageId, i), new g({ messages: o, pendingConsent: this.pendingConsent });
2234
+ }
2235
+ onCanvasComplete(t) {
2236
+ const e = t.fact.messageCanvasComplete.message;
2237
+ if (e.parentToolUseId) return this;
2238
+ const s = e.template?.type === Ie.CANVAS ? e.template : void 0, r = s?.canvas?.html;
2239
+ if (!r) {
2240
+ if (!this.messages?.has(e.messageId)) return this;
2241
+ const u = new Map(this.messages);
2242
+ return u.delete(e.messageId), new g({ messages: u, pendingConsent: this.pendingConsent });
2243
+ }
2244
+ const o = this.messages?.get(e.messageId), i = o?.type === "canvas" ? o : void 0, a = new Map(this.messages), c = {
2245
+ type: "canvas",
2246
+ messageId: e.messageId,
2247
+ // **Replace, never append.** This fragment is authoritative, and a rejoin replays only the
2248
+ // complete — appending here would stream correctly and come back empty after a reload.
2249
+ html: r,
2250
+ title: s?.title,
2251
+ isDrawing: !1,
2252
+ time: i?.time ?? /* @__PURE__ */ new Date(),
2253
+ traceId: t.traceId ?? i?.traceId
2254
+ };
2255
+ return a.set(e.messageId, c), new g({ messages: a, pendingConsent: this.pendingConsent });
2189
2256
  }
2190
2257
  onMessageUser(t) {
2191
2258
  const e = t.fact.messageUser;
2192
2259
  if ((this.messages?.get(e.messageId) ?? (e.customMessageId ? this.messages?.get(e.customMessageId) : void 0))?.type === "user") return this;
2193
- const s = new Map(this.messages), o = {
2260
+ const r = new Map(this.messages), o = {
2194
2261
  type: "user",
2195
2262
  messageId: e.messageId,
2196
2263
  text: e.text,
@@ -2200,26 +2267,26 @@ class b {
2200
2267
  time: /* @__PURE__ */ new Date(),
2201
2268
  traceId: t.traceId
2202
2269
  };
2203
- return s.set(e.messageId, o), new b({ messages: s, pendingConsent: this.pendingConsent });
2270
+ return r.set(e.messageId, o), new g({ messages: r, pendingConsent: this.pendingConsent });
2204
2271
  }
2205
2272
  onMessageError(t) {
2206
- const e = Ke(), r = t.fact.runError.error, s = new Map(this.messages);
2207
- return s.set(e, {
2273
+ const e = Ve(), s = t.fact.runError.error, r = new Map(this.messages);
2274
+ return r.set(e, {
2208
2275
  type: "error",
2209
2276
  eventType: l.ERROR,
2210
2277
  messageId: e,
2211
- error: r,
2278
+ error: s,
2212
2279
  time: /* @__PURE__ */ new Date(),
2213
2280
  traceId: t.traceId
2214
- }), new b({ messages: s, pendingConsent: this.pendingConsent });
2281
+ }), new g({ messages: r, pendingConsent: this.pendingConsent });
2215
2282
  }
2216
2283
  onToolCallStart(t) {
2217
- const e = t.fact.toolCallStart, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`;
2218
- if (this.isTerminalToolCall(this.messages?.get(s))) return this;
2284
+ const e = t.fact.toolCallStart, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`;
2285
+ if (this.isTerminalToolCall(this.messages?.get(r))) return this;
2219
2286
  const o = {
2220
2287
  type: "tool-call",
2221
2288
  eventType: l.TOOL_CALL_START,
2222
- messageId: s,
2289
+ messageId: r,
2223
2290
  processId: e.processId,
2224
2291
  callSeq: e.callSeq,
2225
2292
  toolName: e.toolCall.toolName,
@@ -2232,10 +2299,10 @@ class b {
2232
2299
  time: /* @__PURE__ */ new Date(),
2233
2300
  traceId: t.traceId
2234
2301
  };
2235
- return r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
2302
+ return s.set(r, o), new g({ messages: s, pendingConsent: this.pendingConsent });
2236
2303
  }
2237
2304
  onToolCallComplete(t) {
2238
- const e = t.fact.toolCallComplete, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, o = r.get(s);
2305
+ const e = t.fact.toolCallComplete, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`, o = s.get(r);
2239
2306
  if (o?.type === "tool-call") {
2240
2307
  const i = {
2241
2308
  ...o,
@@ -2246,12 +2313,12 @@ class b {
2246
2313
  isComplete: !0,
2247
2314
  traceId: t.traceId ?? o.traceId
2248
2315
  };
2249
- r.set(s, i);
2316
+ s.set(r, i);
2250
2317
  } else {
2251
2318
  const i = {
2252
2319
  type: "tool-call",
2253
2320
  eventType: l.TOOL_CALL_COMPLETE,
2254
- messageId: s,
2321
+ messageId: r,
2255
2322
  processId: e.processId,
2256
2323
  callSeq: e.callSeq,
2257
2324
  toolName: e.toolCall.toolName,
@@ -2267,18 +2334,18 @@ class b {
2267
2334
  time: /* @__PURE__ */ new Date(),
2268
2335
  traceId: t.traceId
2269
2336
  };
2270
- r.set(s, i);
2337
+ s.set(r, i);
2271
2338
  }
2272
- return new b({ messages: r, pendingConsent: this.pendingConsent });
2339
+ return new g({ messages: s, pendingConsent: this.pendingConsent });
2273
2340
  }
2274
2341
  onToolCallConsent(t) {
2275
2342
  const e = t.fact.toolCallConsent;
2276
- return new b({ messages: this.messages, pendingConsent: e });
2343
+ return new g({ messages: this.messages, pendingConsent: e });
2277
2344
  }
2278
2345
  onSubagentStart(t) {
2279
- const e = t.fact.subagentStart, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:start`, o = {
2346
+ const e = t.fact.subagentStart, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:start`, o = {
2280
2347
  type: "subagent",
2281
- messageId: s,
2348
+ messageId: r,
2282
2349
  kind: "start",
2283
2350
  parentToolUseId: e.parentToolUseId,
2284
2351
  agentId: e.agentId,
@@ -2287,12 +2354,12 @@ class b {
2287
2354
  time: /* @__PURE__ */ new Date(),
2288
2355
  traceId: t.traceId
2289
2356
  };
2290
- return r.delete(s), r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
2357
+ return s.delete(r), s.set(r, o), new g({ messages: s, pendingConsent: this.pendingConsent });
2291
2358
  }
2292
2359
  onSubagentComplete(t) {
2293
- const e = t.fact.subagentComplete, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:complete`, o = {
2360
+ const e = t.fact.subagentComplete, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:complete`, o = {
2294
2361
  type: "subagent",
2295
- messageId: s,
2362
+ messageId: r,
2296
2363
  kind: "complete",
2297
2364
  parentToolUseId: e.parentToolUseId,
2298
2365
  agentId: e.agentId,
@@ -2302,7 +2369,7 @@ class b {
2302
2369
  time: /* @__PURE__ */ new Date(),
2303
2370
  traceId: t.traceId
2304
2371
  };
2305
- return r.delete(s), r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
2372
+ return s.delete(r), s.set(r, o), new g({ messages: s, pendingConsent: this.pendingConsent });
2306
2373
  }
2307
2374
  }
2308
2375
  const pn = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
@@ -2312,32 +2379,32 @@ function mn(n) {
2312
2379
  function Se(n) {
2313
2380
  return typeof n == "object" && n !== null ? n : void 0;
2314
2381
  }
2315
- function I(n) {
2382
+ function E(n) {
2316
2383
  return typeof n == "string" ? n : void 0;
2317
2384
  }
2318
2385
  function gn(n) {
2319
2386
  const t = [], e = /* @__PURE__ */ new Map();
2320
- for (const r of n) {
2321
- const s = r.parameter ?? {}, o = r.sidecar ?? {};
2322
- if (r.toolName === "TaskCreate") {
2323
- const i = Se(o.task), a = I(i?.id);
2387
+ for (const s of n) {
2388
+ const r = s.parameter ?? {}, o = s.sidecar ?? {};
2389
+ if (s.toolName === "TaskCreate") {
2390
+ const i = Se(o.task), a = E(i?.id);
2324
2391
  if (!a) continue;
2325
2392
  e.has(a) || t.push(a), e.set(a, {
2326
2393
  id: a,
2327
- subject: I(s.subject) || I(i?.subject) || "",
2328
- activeForm: I(s.activeForm),
2329
- description: I(s.description),
2394
+ subject: E(r.subject) || E(i?.subject) || "",
2395
+ activeForm: E(r.activeForm),
2396
+ description: E(r.description),
2330
2397
  status: e.get(a)?.status ?? "pending"
2331
2398
  // initial status = pending (keep existing on repeat)
2332
2399
  });
2333
- } else if (r.toolName === "TaskUpdate") {
2334
- const i = Se(o.statusChange), a = I(s.taskId) || I(o.taskId), u = I(i?.to) || I(s.status);
2335
- if (!a || !u) continue;
2336
- const c = e.get(a);
2337
- c && e.set(a, { ...c, status: u });
2400
+ } else if (s.toolName === "TaskUpdate") {
2401
+ const i = Se(o.statusChange), a = E(r.taskId) || E(o.taskId), c = E(i?.to) || E(r.status);
2402
+ if (!a || !c) continue;
2403
+ const u = e.get(a);
2404
+ u && e.set(a, { ...u, status: c });
2338
2405
  }
2339
2406
  }
2340
- return t.map((r) => e.get(r));
2407
+ return t.map((s) => e.get(s));
2341
2408
  }
2342
2409
  function bn(n) {
2343
2410
  return n.toolsetName === "" && n.toolName === "Agent";
@@ -2349,21 +2416,21 @@ function ye(n) {
2349
2416
  n.status !== "running" && (n.status = "running", n.summary = void 0);
2350
2417
  }
2351
2418
  function Sn(n) {
2352
- 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));
2419
+ const t = [], e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = (o) => (e.has(o) || (t.push(o), e.set(o, { status: "running" }), s.set(o, /* @__PURE__ */ new Map())), e.get(o));
2353
2420
  for (const o of n)
2354
2421
  switch (o.kind) {
2355
2422
  case "agentStart": {
2356
- const i = s(o.toolUseId);
2423
+ const i = r(o.toolUseId);
2357
2424
  o.description && !i.description && (i.description = o.description);
2358
2425
  break;
2359
2426
  }
2360
2427
  case "subagentStart": {
2361
- const i = s(o.parentToolUseId);
2428
+ const i = r(o.parentToolUseId);
2362
2429
  i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description, ye(i);
2363
2430
  break;
2364
2431
  }
2365
2432
  case "toolStart": {
2366
- ye(s(o.parentToolUseId)), r.get(o.parentToolUseId).set(o.toolUseId, {
2433
+ ye(r(o.parentToolUseId)), s.get(o.parentToolUseId).set(o.toolUseId, {
2367
2434
  toolsetName: o.toolsetName,
2368
2435
  toolName: o.toolName,
2369
2436
  parameter: o.parameter ?? {},
@@ -2373,12 +2440,12 @@ function Sn(n) {
2373
2440
  break;
2374
2441
  }
2375
2442
  case "toolComplete": {
2376
- const i = r.get(o.parentToolUseId)?.get(o.toolUseId);
2443
+ const i = s.get(o.parentToolUseId)?.get(o.toolUseId);
2377
2444
  i && (i.status = o.isError ? "error" : "completed");
2378
2445
  break;
2379
2446
  }
2380
2447
  case "subagentComplete": {
2381
- const i = s(o.parentToolUseId);
2448
+ const i = r(o.parentToolUseId);
2382
2449
  i.status = o.status, i.summary = o.summary;
2383
2450
  break;
2384
2451
  }
@@ -2386,7 +2453,7 @@ function Sn(n) {
2386
2453
  return t.map((o) => ({
2387
2454
  parentToolUseId: o,
2388
2455
  ...e.get(o),
2389
- tools: Array.from(r.get(o).values())
2456
+ tools: Array.from(s.get(o).values())
2390
2457
  }));
2391
2458
  }
2392
2459
  function yn(n) {
@@ -2404,11 +2471,11 @@ function wn(n) {
2404
2471
  continue;
2405
2472
  }
2406
2473
  if (e.type === "tool-call" && vn(e.parentToolUseId)) {
2407
- const r = e.toolUseId ?? e.messageId;
2474
+ const s = e.toolUseId ?? e.messageId;
2408
2475
  t.push({
2409
2476
  kind: "toolStart",
2410
2477
  parentToolUseId: e.parentToolUseId,
2411
- toolUseId: r,
2478
+ toolUseId: s,
2412
2479
  toolsetName: e.toolsetName,
2413
2480
  toolName: e.toolName,
2414
2481
  parameter: e.parameter,
@@ -2416,7 +2483,7 @@ function wn(n) {
2416
2483
  }), e.isComplete && t.push({
2417
2484
  kind: "toolComplete",
2418
2485
  parentToolUseId: e.parentToolUseId,
2419
- toolUseId: r,
2486
+ toolUseId: s,
2420
2487
  isError: e.isError
2421
2488
  });
2422
2489
  continue;
@@ -2440,53 +2507,53 @@ function wn(n) {
2440
2507
  }
2441
2508
  return t;
2442
2509
  }
2443
- function En(n) {
2510
+ function In(n) {
2444
2511
  const t = Array.from(n.messages?.values() ?? []).filter(
2445
2512
  (e) => e.type === "tool-call" && e.isComplete && mn(e)
2446
2513
  );
2447
2514
  return gn(t);
2448
2515
  }
2449
- function In(n) {
2516
+ function En(n) {
2450
2517
  return Sn(wn(Array.from(n.messages?.values() ?? [])));
2451
2518
  }
2452
2519
  function Tn(n, t) {
2453
- return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
2454
- const s = t[r];
2455
- return e.id === s.id && e.status === s.status && e.subject === s.subject && e.activeForm === s.activeForm && e.description === s.description;
2520
+ return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
2521
+ const r = t[s];
2522
+ return e.id === r.id && e.status === r.status && e.subject === r.subject && e.activeForm === r.activeForm && e.description === r.description;
2456
2523
  });
2457
2524
  }
2458
2525
  function Cn(n, t) {
2459
- return n.length !== t.length ? !1 : n.every((e, r) => {
2460
- const s = t[r];
2461
- return e.toolName === s.toolName && e.toolsetName === s.toolsetName && e.status === s.status && e.reason === s.reason;
2526
+ return n.length !== t.length ? !1 : n.every((e, s) => {
2527
+ const r = t[s];
2528
+ return e.toolName === r.toolName && e.toolsetName === r.toolsetName && e.status === r.status && e.reason === r.reason;
2462
2529
  });
2463
2530
  }
2464
2531
  function xn(n, t) {
2465
- return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
2466
- const s = t[r];
2467
- return e.parentToolUseId === s.parentToolUseId && e.status === s.status && e.subagentType === s.subagentType && e.description === s.description && e.summary === s.summary && Cn(e.tools, s.tools);
2532
+ return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
2533
+ const r = t[s];
2534
+ return e.parentToolUseId === r.parentToolUseId && e.status === r.status && e.subagentType === r.subagentType && e.description === r.description && e.summary === r.summary && Cn(e.tools, r.tools);
2468
2535
  });
2469
2536
  }
2470
- function On(n) {
2471
- const t = new T([]), e = new T([]), r = new j();
2472
- return r.add(n.pipe(R(En), U(Tn)).subscribe(t)), r.add(
2473
- n.pipe(R(In), U(xn)).subscribe(e)
2537
+ function An(n) {
2538
+ const t = new T([]), e = new T([]), s = new j();
2539
+ return s.add(n.pipe(R(In), M(Tn)).subscribe(t)), s.add(
2540
+ n.pipe(R(En), M(xn)).subscribe(e)
2474
2541
  ), {
2475
2542
  tasks$: t.asObservable(),
2476
2543
  subagents$: e.asObservable(),
2477
2544
  getTasks: () => t.value,
2478
2545
  getSubagents: () => e.value,
2479
- teardown: () => r.unsubscribe()
2546
+ teardown: () => s.unsubscribe()
2480
2547
  };
2481
2548
  }
2482
2549
  function we(n) {
2483
2550
  const t = /* @__PURE__ */ new Map();
2484
2551
  for (const e of n) t.set(e.sandboxName, e);
2485
2552
  return [...t.values()].sort(
2486
- (e, r) => (e.sandboxBlueprintName || e.sandboxName).localeCompare(r.sandboxBlueprintName || r.sandboxName)
2553
+ (e, s) => (e.sandboxBlueprintName || e.sandboxName).localeCompare(s.sandboxBlueprintName || s.sandboxName)
2487
2554
  );
2488
2555
  }
2489
- const Q = { kind: null, stopPhase: "idle" }, An = 1e4;
2556
+ const Q = { kind: null, stopPhase: "idle" }, On = 1e4;
2490
2557
  function Pn(n, t) {
2491
2558
  return n.kind === t.kind && n.stopPhase === t.stopPhase && n.requestId === t.requestId;
2492
2559
  }
@@ -2552,7 +2619,7 @@ class q {
2552
2619
  throw new Error("customChannelId must be required");
2553
2620
  this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new T(!1), this.runStatusSubject = new T(Q), this.conversation$ = new T(t.conversation), this.channelTitleSubject = new T(t.channelTitle ?? null), this.promptSuggestionSubject = new T(null), this.sandboxPhaseSubject = new T("idle"), this.launchedSandboxesSubject = new T(
2554
2621
  we(t.launchedSandboxes ?? [])
2555
- ), this.derivedStores = On(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(U()), this.promptSuggestion$ = this.promptSuggestionSubject.pipe(U()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(U()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(U()), this.runStatus$ = this.runStatusSubject.pipe(U(Pn)), this.statesObserver = t.statesObserver;
2622
+ ), this.derivedStores = An(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(M()), this.promptSuggestion$ = this.promptSuggestionSubject.pipe(M()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(M()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(M()), this.runStatus$ = this.runStatusSubject.pipe(M(Pn)), this.statesObserver = t.statesObserver;
2556
2623
  }
2557
2624
  /** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
2558
2625
  getTasks() {
@@ -2601,15 +2668,15 @@ class q {
2601
2668
  */
2602
2669
  applyLaunchedSandboxes(t) {
2603
2670
  const e = we(t);
2604
- this.pendingLaunches = this.pendingLaunches.filter((r) => !e.some((s) => s.sandboxName === r)), this.launchedSandboxesSubject.next(e);
2671
+ this.pendingLaunches = this.pendingLaunches.filter((s) => !e.some((r) => r.sandboxName === s)), this.launchedSandboxesSubject.next(e);
2605
2672
  }
2606
2673
  /**
2607
2674
  * Optimistically drop one sandbox (F-019) — e.g. its fs calls keep failing or it is known to be
2608
2675
  * recycled. The next `/channel/metadata` refetch reconciles the authoritative truth.
2609
2676
  */
2610
2677
  dropSandbox(t) {
2611
- const e = this.launchedSandboxesSubject.value, r = e.filter((s) => s.sandboxName !== t);
2612
- r.length !== e.length && this.launchedSandboxesSubject.next(r);
2678
+ const e = this.launchedSandboxesSubject.value, s = e.filter((r) => r.sandboxName !== t);
2679
+ s.length !== e.length && this.launchedSandboxesSubject.next(s);
2613
2680
  }
2614
2681
  /**
2615
2682
  * Record an `asgard.sandbox.launch` hint (F-019): the event is not trusted to add a live sandbox (it may
@@ -2637,10 +2704,10 @@ class q {
2637
2704
  const e = new q(t);
2638
2705
  return e.subscribe(), e;
2639
2706
  }
2640
- static async reset(t, e, r, s) {
2707
+ static async reset(t, e, s, r) {
2641
2708
  const o = new q(t);
2642
2709
  try {
2643
- return o.subscribe(), s?.(o), await o.resetChannel(e, r), o;
2710
+ return o.subscribe(), r?.(o), await o.resetChannel(e, s), o;
2644
2711
  } catch (i) {
2645
2712
  throw o.close(), i;
2646
2713
  }
@@ -2652,16 +2719,16 @@ class q {
2652
2719
  * so the channel's history / session / title are preserved — this is the fix for the mount-time
2653
2720
  * "join an existing channel and wipe its history" data-loss bug.
2654
2721
  */
2655
- static async restore(t, e, r) {
2656
- const s = new q(t);
2722
+ static async restore(t, e, s) {
2723
+ const r = new q(t);
2657
2724
  try {
2658
- return s.subscribe(), r?.(s), await s.rejoinChannel(e), s;
2725
+ return r.subscribe(), s?.(r), await r.rejoinChannel(e), r;
2659
2726
  } catch (o) {
2660
- throw s.close(), o;
2727
+ throw r.close(), o;
2661
2728
  }
2662
2729
  }
2663
2730
  subscribe() {
2664
- this.statesSubscription = Vt([
2731
+ this.statesSubscription = Xt([
2665
2732
  this.isConnecting$,
2666
2733
  this.conversation$,
2667
2734
  this.derivedStores.tasks$,
@@ -2676,23 +2743,23 @@ class q {
2676
2743
  ([
2677
2744
  t,
2678
2745
  e,
2679
- r,
2680
2746
  s,
2747
+ r,
2681
2748
  o,
2682
2749
  i,
2683
2750
  a,
2684
- u,
2685
- c
2751
+ c,
2752
+ u
2686
2753
  ]) => ({
2687
2754
  isConnecting: t,
2688
2755
  conversation: e,
2689
- tasks: r,
2690
- subagents: s,
2756
+ tasks: s,
2757
+ subagents: r,
2691
2758
  channelTitle: o,
2692
2759
  promptSuggestion: i,
2693
2760
  sandboxPhase: a,
2694
- launchedSandboxes: u,
2695
- runStatus: c
2761
+ launchedSandboxes: c,
2762
+ runStatus: u
2696
2763
  })
2697
2764
  )
2698
2765
  ).subscribe(this.statesObserver);
@@ -2735,27 +2802,27 @@ class q {
2735
2802
  * through the conversation reducer, keep the title store in sync, attach the traceId to the pending
2736
2803
  * user bubble, and settle the run promise (releasing `isConnecting`) on completion / error.
2737
2804
  */
2738
- buildRunHandlers(t, e, r) {
2805
+ buildRunHandlers(t, e, s) {
2739
2806
  return {
2740
2807
  onSseStart: t?.onSseStart,
2741
- onSseMessage: (s) => {
2742
- if (t?.onSseMessage?.(s), this.captureRequestId(s.requestId), s.eventType === l.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
2743
- s.fact.channelTitleUpdate.title
2744
- ), s.eventType === l.PROMPT_SUGGESTION ? this.promptSuggestionSubject.next(
2745
- s.fact.promptSuggestion.suggestion
2746
- ) : s.eventType === l.INIT && this.clearPromptSuggestion(), this.updateSandboxPhase(s.eventType), s.eventType === l.SANDBOX_LAUNCH && this.noteSandboxLaunch(s.fact.sandboxLaunch.sandboxName), this.currentUserMessageId && s.traceId) {
2808
+ onSseMessage: (r) => {
2809
+ if (t?.onSseMessage?.(r), this.captureRequestId(r.requestId), r.eventType === l.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
2810
+ r.fact.channelTitleUpdate.title
2811
+ ), r.eventType === l.PROMPT_SUGGESTION ? this.promptSuggestionSubject.next(
2812
+ r.fact.promptSuggestion.suggestion
2813
+ ) : r.eventType === l.INIT && this.clearPromptSuggestion(), this.updateSandboxPhase(r.eventType), r.eventType === l.SANDBOX_LAUNCH && this.noteSandboxLaunch(r.fact.sandboxLaunch.sandboxName), this.currentUserMessageId && r.traceId) {
2747
2814
  const o = new Map(this.conversation$.value.messages), i = o.get(this.currentUserMessageId);
2748
2815
  i && i.type === "user" && (o.set(this.currentUserMessageId, {
2749
2816
  ...i,
2750
- traceId: s.traceId
2817
+ traceId: r.traceId
2751
2818
  }), this.conversation$.next(
2752
- new b({ messages: o, pendingConsent: this.conversation$.value.pendingConsent })
2819
+ new g({ messages: o, pendingConsent: this.conversation$.value.pendingConsent })
2753
2820
  )), this.currentUserMessageId = void 0;
2754
2821
  }
2755
- this.conversation$.next(this.conversation$.value.onMessage(s));
2822
+ this.conversation$.next(this.conversation$.value.onMessage(r));
2756
2823
  },
2757
- onSseError: (s) => {
2758
- t?.onSseError?.(s), this.settleRun(), r(s);
2824
+ onSseError: (r) => {
2825
+ t?.onSseError?.(r), this.settleRun(), s(r);
2759
2826
  },
2760
2827
  onSseCompleted: () => {
2761
2828
  t?.onSseCompleted?.(), this.settleRun(), e();
@@ -2779,9 +2846,9 @@ class q {
2779
2846
  clearForceStopTimer() {
2780
2847
  this.forceStopTimer && (clearTimeout(this.forceStopTimer), this.forceStopTimer = void 0);
2781
2848
  }
2782
- fetchSse(t, e, r) {
2783
- return new Promise((s, o) => {
2784
- this.isConnecting$.next(!0), this.runStatusSubject.next({ kind: t, stopPhase: "idle" }), this.currentRun = this.client.fetchSse(e, this.buildRunHandlers(r, s, o));
2849
+ fetchSse(t, e, s) {
2850
+ return new Promise((r, o) => {
2851
+ this.isConnecting$.next(!0), this.runStatusSubject.next({ kind: t, stopPhase: "idle" }), this.currentRun = this.client.fetchSse(e, this.buildRunHandlers(s, r, o));
2785
2852
  });
2786
2853
  }
2787
2854
  /**
@@ -2791,7 +2858,7 @@ class q {
2791
2858
  * restore), so the input is released rather than stuck.
2792
2859
  */
2793
2860
  rejoinChannel(t) {
2794
- return new Promise((e, r) => {
2861
+ return new Promise((e, s) => {
2795
2862
  if (!this.client.rejoinSse) {
2796
2863
  e();
2797
2864
  return;
@@ -2799,7 +2866,7 @@ class q {
2799
2866
  this.isConnecting$.next(!0), this.runStatusSubject.next({
2800
2867
  kind: this.joinRunState === "RUNNING" ? "restore" : "replay",
2801
2868
  stopPhase: "idle"
2802
- }), this.currentRun = this.client.rejoinSse(this.customChannelId, this.buildRunHandlers(t, e, r));
2869
+ }), this.currentRun = this.client.rejoinSse(this.customChannelId, this.buildRunHandlers(t, e, s));
2803
2870
  });
2804
2871
  }
2805
2872
  resetChannel(t, e) {
@@ -2816,12 +2883,12 @@ class q {
2816
2883
  );
2817
2884
  }
2818
2885
  sendMessage(t, e) {
2819
- const r = this.runStatusSubject.value.kind;
2820
- if (r) return Promise.reject(new Z(r));
2821
- const s = this.conversation$.value.pendingConsent;
2822
- if (s) return Promise.reject(new ee(s.processId));
2886
+ const s = this.runStatusSubject.value.kind;
2887
+ if (s) return Promise.reject(new Z(s));
2888
+ const r = this.conversation$.value.pendingConsent;
2889
+ if (r) return Promise.reject(new ee(r.processId));
2823
2890
  this.clearPromptSuggestion();
2824
- const o = t.text.trim(), i = t.customMessageId ?? Ke();
2891
+ const o = t.text.trim(), i = t.customMessageId ?? Ve();
2825
2892
  return this.currentUserMessageId = i, this.lastSentMessageId = i, this.conversation$.next(
2826
2893
  this.conversation$.value.pushMessage({
2827
2894
  type: "user",
@@ -2845,21 +2912,21 @@ class q {
2845
2912
  e
2846
2913
  );
2847
2914
  }
2848
- replyToolCallConsents(t, e, r) {
2849
- const s = this.conversation$.value.pendingConsent;
2915
+ replyToolCallConsents(t, e, s) {
2916
+ const r = this.conversation$.value.pendingConsent;
2850
2917
  return this.conversation$.next(this.conversation$.value.clearPendingConsent()), this.fetchSse(
2851
2918
  "user",
2852
2919
  {
2853
2920
  action: $.RESPONSE_TOOL_CALL_CONSENT,
2854
2921
  customChannelId: this.customChannelId,
2855
2922
  customMessageId: this.lastSentMessageId ?? this.customMessageId,
2856
- payload: this.resolvePayload(r),
2923
+ payload: this.resolvePayload(s),
2857
2924
  text: "",
2858
2925
  toolCallConsents: t
2859
2926
  },
2860
2927
  e
2861
2928
  ).catch((o) => {
2862
- throw s && this.conversation$.next(this.conversation$.value.restorePendingConsent(s)), o;
2929
+ throw r && this.conversation$.next(this.conversation$.value.restorePendingConsent(r)), o;
2863
2930
  });
2864
2931
  }
2865
2932
  /**
@@ -2883,10 +2950,10 @@ class q {
2883
2950
  * `ChannelAwaitingConsentError` while a consent prompt is pending — exactly like `sendMessage`.
2884
2951
  */
2885
2952
  nudge(t, e) {
2886
- const r = this.runStatusSubject.value.kind;
2887
- if (r) return Promise.reject(new Z(r));
2888
- const s = this.conversation$.value.pendingConsent;
2889
- return s ? Promise.reject(new ee(s.processId)) : this.fetchSse(
2953
+ const s = this.runStatusSubject.value.kind;
2954
+ if (s) return Promise.reject(new Z(s));
2955
+ const r = this.conversation$.value.pendingConsent;
2956
+ return r ? Promise.reject(new ee(r.processId)) : this.fetchSse(
2890
2957
  "nudge",
2891
2958
  {
2892
2959
  action: $.NUDGE,
@@ -2939,8 +3006,8 @@ class q {
2939
3006
  requestId: e.requestId,
2940
3007
  force: t?.force
2941
3008
  });
2942
- } catch (r) {
2943
- throw this.clearForceStopTimer(), this.runStatusSubject.next({ ...this.runStatusSubject.value, stopPhase: "idle" }), r;
3009
+ } catch (s) {
3010
+ throw this.clearForceStopTimer(), this.runStatusSubject.next({ ...this.runStatusSubject.value, stopPhase: "idle" }), s;
2944
3011
  }
2945
3012
  this.armForceStopTimer();
2946
3013
  }
@@ -2955,7 +3022,7 @@ class q {
2955
3022
  this.forceStopTimer = void 0;
2956
3023
  const t = this.runStatusSubject.value;
2957
3024
  t.stopPhase === "stopping" && this.runStatusSubject.next({ ...t, stopPhase: "force-stoppable" });
2958
- }, An);
3025
+ }, On);
2959
3026
  }
2960
3027
  /**
2961
3028
  * Cut the local SSE connection without telling the backend. This is *not* stop-generation (see
@@ -2975,31 +3042,31 @@ class q {
2975
3042
  function Nn(n) {
2976
3043
  const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
2977
3044
  if (!t) return null;
2978
- const e = decodeURIComponent(t[1]), r = t[2], s = new URLSearchParams(t[3] ?? "");
2979
- if (r === "open-browser") return { kind: "open-browser", sandboxName: e };
2980
- if (r === "open-file") {
2981
- const o = s.get("absolute_path");
3045
+ const e = decodeURIComponent(t[1]), s = t[2], r = new URLSearchParams(t[3] ?? "");
3046
+ if (s === "open-browser") return { kind: "open-browser", sandboxName: e };
3047
+ if (s === "open-file") {
3048
+ const o = r.get("absolute_path");
2982
3049
  return o ? { kind: "open-file", sandboxName: e, absolutePath: o } : null;
2983
3050
  }
2984
3051
  return null;
2985
3052
  }
2986
3053
  export {
2987
- Mn as AsgardServiceClient,
3054
+ Un as AsgardServiceClient,
2988
3055
  q as Channel,
2989
3056
  ee as ChannelAwaitingConsentError,
2990
3057
  Z as ChannelBusyError,
2991
- b as Conversation,
3058
+ g as Conversation,
2992
3059
  l as EventType,
2993
3060
  $ as FetchSseAction,
2994
3061
  w as HttpError,
2995
- Ve as MessageTemplateType,
3062
+ Ie as MessageTemplateType,
2996
3063
  Xe as ToolCallConsentResult,
2997
3064
  wn as conversationToSubagentEvents,
2998
- On as createDerivedStores,
2999
- In as deriveSubagents,
3000
- En as deriveTasks,
3065
+ An as createDerivedStores,
3066
+ En as deriveSubagents,
3067
+ In as deriveTasks,
3001
3068
  bn as isAgentTool,
3002
- Un as isChannelAwaitingConsentError,
3069
+ Mn as isChannelAwaitingConsentError,
3003
3070
  Ln as isChannelBusyError,
3004
3071
  _n as isHttpError,
3005
3072
  vn as isSubagentChildTool,