@asgard-js/core 0.2.20 → 0.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- var B = /* @__PURE__ */ ((r) => (r.RESET_CHANNEL = "RESET_CHANNEL", r.NONE = "NONE", r))(B || {}), d = /* @__PURE__ */ ((r) => (r.INIT = "asgard.run.init", r.PROCESS = "asgard.process", r.PROCESS_START = "asgard.process.start", r.PROCESS_COMPLETE = "asgard.process.complete", r.MESSAGE = "asgard.message", r.MESSAGE_START = "asgard.message.start", r.MESSAGE_DELTA = "asgard.message.delta", r.MESSAGE_COMPLETE = "asgard.message.complete", r.TOOL_CALL = "asgard.tool_call", r.TOOL_CALL_START = "asgard.tool_call.start", r.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", r.DONE = "asgard.run.done", r.ERROR = "asgard.run.error", r.VIEW_UPDATE = "asgard.data_insight.view_update", r))(d || {}), je = /* @__PURE__ */ ((r) => (r.TEXT = "TEXT", r.HINT = "HINT", r.BUTTON = "BUTTON", r.IMAGE = "IMAGE", r.VIDEO = "VIDEO", r.AUDIO = "AUDIO", r.LOCATION = "LOCATION", r.CAROUSEL = "CAROUSEL", r.CHART = "CHART", r.TABLE = "TABLE", r))(je || {}), W = function(r, e) {
2
- return W = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
1
+ var B = /* @__PURE__ */ ((r) => (r.RESET_CHANNEL = "RESET_CHANNEL", r.NONE = "NONE", r))(B || {}), d = /* @__PURE__ */ ((r) => (r.INIT = "asgard.run.init", r.PROCESS = "asgard.process", r.PROCESS_START = "asgard.process.start", r.PROCESS_COMPLETE = "asgard.process.complete", r.MESSAGE = "asgard.message", r.MESSAGE_START = "asgard.message.start", r.MESSAGE_DELTA = "asgard.message.delta", r.MESSAGE_COMPLETE = "asgard.message.complete", r.TOOL_CALL = "asgard.tool_call", r.TOOL_CALL_START = "asgard.tool_call.start", r.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", r.DONE = "asgard.run.done", r.ERROR = "asgard.run.error", r))(d || {}), De = /* @__PURE__ */ ((r) => (r.TEXT = "TEXT", r.HINT = "HINT", r.BUTTON = "BUTTON", r.IMAGE = "IMAGE", r.VIDEO = "VIDEO", r.AUDIO = "AUDIO", r.LOCATION = "LOCATION", r.CAROUSEL = "CAROUSEL", r.CHART = "CHART", r.TABLE = "TABLE", r))(De || {}), Y = function(r, e) {
2
+ return Y = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
3
3
  t.__proto__ = n;
4
4
  } || function(t, n) {
5
5
  for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
6
- }, W(r, e);
6
+ }, Y(r, e);
7
7
  };
8
8
  function O(r, e) {
9
9
  if (typeof e != "function" && e !== null)
10
10
  throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
11
- W(r, e);
11
+ Y(r, e);
12
12
  function t() {
13
13
  this.constructor = r;
14
14
  }
@@ -136,7 +136,7 @@ function R(r, e, t) {
136
136
  function P(r) {
137
137
  return this instanceof P ? (this.v = r, this) : new P(r);
138
138
  }
139
- function Ve(r, e, t) {
139
+ function Ge(r, e, t) {
140
140
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
141
141
  var n = t.apply(r, e || []), o, i = [];
142
142
  return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", s), o[Symbol.asyncIterator] = function() {
@@ -149,8 +149,8 @@ function Ve(r, e, t) {
149
149
  }
150
150
  function a(l, y) {
151
151
  n[l] && (o[l] = function(p) {
152
- return new Promise(function(w, E) {
153
- i.push([l, p, w, E]) > 1 || c(l, p);
152
+ return new Promise(function(S, w) {
153
+ i.push([l, p, S, w]) > 1 || c(l, p);
154
154
  });
155
155
  }, y && (o[l] = y(o[l])));
156
156
  }
@@ -174,7 +174,7 @@ function Ve(r, e, t) {
174
174
  l(y), i.shift(), i.length && c(i[0][0], i[0][1]);
175
175
  }
176
176
  }
177
- function Ge(r) {
177
+ function He(r) {
178
178
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
179
179
  var e = r[Symbol.asyncIterator], t;
180
180
  return e ? e.call(r) : (r = typeof M == "function" ? M(r) : r[Symbol.iterator](), t = {}, n("next"), n("throw"), n("return"), t[Symbol.asyncIterator] = function() {
@@ -202,7 +202,7 @@ function he(r) {
202
202
  }, t = r(e);
203
203
  return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
204
204
  }
205
- var F = he(function(r) {
205
+ var q = he(function(r) {
206
206
  return function(t) {
207
207
  r(this), this.message = t ? t.length + ` errors occurred during unsubscription:
208
208
  ` + t.map(function(n, o) {
@@ -211,7 +211,7 @@ var F = he(function(r) {
211
211
  `) : "", this.name = "UnsubscriptionError", this.errors = t;
212
212
  };
213
213
  });
214
- function j(r, e) {
214
+ function D(r, e) {
215
215
  if (r) {
216
216
  var t = r.indexOf(e);
217
217
  0 <= t && r.splice(t, 1);
@@ -249,7 +249,7 @@ var U = (function() {
249
249
  try {
250
250
  f();
251
251
  } catch (p) {
252
- i = p instanceof F ? p.errors : [p];
252
+ i = p instanceof q ? p.errors : [p];
253
253
  }
254
254
  var h = this._finalizers;
255
255
  if (h) {
@@ -260,7 +260,7 @@ var U = (function() {
260
260
  try {
261
261
  re(y);
262
262
  } catch (p) {
263
- i = i ?? [], p instanceof F ? i = R(R([], L(i)), L(p.errors)) : i.push(p);
263
+ i = i ?? [], p instanceof q ? i = R(R([], L(i)), L(p.errors)) : i.push(p);
264
264
  }
265
265
  }
266
266
  } catch (p) {
@@ -274,7 +274,7 @@ var U = (function() {
274
274
  }
275
275
  }
276
276
  if (i)
277
- throw new F(i);
277
+ throw new q(i);
278
278
  }
279
279
  }, r.prototype.add = function(e) {
280
280
  var t;
@@ -297,10 +297,10 @@ var U = (function() {
297
297
  this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
298
298
  }, r.prototype._removeParent = function(e) {
299
299
  var t = this._parentage;
300
- t === e ? this._parentage = null : Array.isArray(t) && j(t, e);
300
+ t === e ? this._parentage = null : Array.isArray(t) && D(t, e);
301
301
  }, r.prototype.remove = function(e) {
302
302
  var t = this._finalizers;
303
- t && j(t, e), e instanceof r && e._removeParent(this);
303
+ t && D(t, e), e instanceof r && e._removeParent(this);
304
304
  }, r.EMPTY = (function() {
305
305
  var e = new r();
306
306
  return e.closed = !0, e;
@@ -312,9 +312,9 @@ function pe(r) {
312
312
  function re(r) {
313
313
  m(r) ? r() : r.unsubscribe();
314
314
  }
315
- var He = {
315
+ var Fe = {
316
316
  Promise: void 0
317
- }, qe = {
317
+ }, Ve = {
318
318
  setTimeout: function(r, e) {
319
319
  for (var t = [], n = 2; n < arguments.length; n++)
320
320
  t[n - 2] = arguments[n];
@@ -326,13 +326,13 @@ var He = {
326
326
  delegate: void 0
327
327
  };
328
328
  function ye(r) {
329
- qe.setTimeout(function() {
329
+ Ve.setTimeout(function() {
330
330
  throw r;
331
331
  });
332
332
  }
333
- function Y() {
333
+ function W() {
334
334
  }
335
- function $(r) {
335
+ function j(r) {
336
336
  r();
337
337
  }
338
338
  var Q = (function(r) {
@@ -366,7 +366,7 @@ var Q = (function(r) {
366
366
  this.unsubscribe();
367
367
  }
368
368
  }, e;
369
- })(U), Fe = (function() {
369
+ })(U), qe = (function() {
370
370
  function r(e) {
371
371
  this.partialObserver = e;
372
372
  }
@@ -376,7 +376,7 @@ var Q = (function(r) {
376
376
  try {
377
377
  t.next(e);
378
378
  } catch (n) {
379
- D(n);
379
+ $(n);
380
380
  }
381
381
  }, r.prototype.error = function(e) {
382
382
  var t = this.partialObserver;
@@ -384,17 +384,17 @@ var Q = (function(r) {
384
384
  try {
385
385
  t.error(e);
386
386
  } catch (n) {
387
- D(n);
387
+ $(n);
388
388
  }
389
389
  else
390
- D(e);
390
+ $(e);
391
391
  }, r.prototype.complete = function() {
392
392
  var e = this.partialObserver;
393
393
  if (e.complete)
394
394
  try {
395
395
  e.complete();
396
396
  } catch (t) {
397
- D(t);
397
+ $(t);
398
398
  }
399
399
  }, r;
400
400
  })(), X = (function(r) {
@@ -405,11 +405,11 @@ var Q = (function(r) {
405
405
  next: t ?? void 0,
406
406
  error: n ?? void 0,
407
407
  complete: o ?? void 0
408
- } : s = t, i.destination = new Fe(s), i;
408
+ } : s = t, i.destination = new qe(s), i;
409
409
  }
410
410
  return e;
411
411
  })(Q);
412
- function D(r) {
412
+ function $(r) {
413
413
  ye(r);
414
414
  }
415
415
  function Ke(r) {
@@ -417,17 +417,17 @@ function Ke(r) {
417
417
  }
418
418
  var Be = {
419
419
  closed: !0,
420
- next: Y,
420
+ next: W,
421
421
  error: Ke,
422
- complete: Y
422
+ complete: W
423
423
  }, Z = (function() {
424
424
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
425
425
  })();
426
- function V(r) {
426
+ function G(r) {
427
427
  return r;
428
428
  }
429
- function We(r) {
430
- return r.length === 0 ? V : r.length === 1 ? r[0] : function(t) {
429
+ function Ye(r) {
430
+ return r.length === 0 ? G : r.length === 1 ? r[0] : function(t) {
431
431
  return r.reduce(function(n, o) {
432
432
  return o(n);
433
433
  }, t);
@@ -442,7 +442,7 @@ var g = (function() {
442
442
  return t.source = this, t.operator = e, t;
443
443
  }, r.prototype.subscribe = function(e, t, n) {
444
444
  var o = this, i = Xe(e) ? e : new X(e, t, n);
445
- return $(function() {
445
+ return j(function() {
446
446
  var s = o, a = s.operator, c = s.source;
447
447
  i.add(a ? a.call(i, c) : c ? o._subscribe(i) : o._trySubscribe(i));
448
448
  }), i;
@@ -476,7 +476,7 @@ var g = (function() {
476
476
  }, r.prototype.pipe = function() {
477
477
  for (var e = [], t = 0; t < arguments.length; t++)
478
478
  e[t] = arguments[t];
479
- return We(e)(this);
479
+ return Ye(e)(this);
480
480
  }, r.prototype.toPromise = function(e) {
481
481
  var t = this;
482
482
  return e = ne(e), new e(function(n, o) {
@@ -495,18 +495,18 @@ var g = (function() {
495
495
  })();
496
496
  function ne(r) {
497
497
  var e;
498
- return (e = r ?? He.Promise) !== null && e !== void 0 ? e : Promise;
498
+ return (e = r ?? Fe.Promise) !== null && e !== void 0 ? e : Promise;
499
499
  }
500
- function Ye(r) {
500
+ function We(r) {
501
501
  return r && m(r.next) && m(r.error) && m(r.complete);
502
502
  }
503
503
  function Xe(r) {
504
- return r && r instanceof Q || Ye(r) && pe(r);
504
+ return r && r instanceof Q || We(r) && pe(r);
505
505
  }
506
506
  function Je(r) {
507
507
  return m(r?.lift);
508
508
  }
509
- function x(r) {
509
+ function _(r) {
510
510
  return function(e) {
511
511
  if (Je(e))
512
512
  return e.lift(function(t) {
@@ -575,7 +575,7 @@ var ze = (function(r) {
575
575
  throw new Qe();
576
576
  }, e.prototype.next = function(t) {
577
577
  var n = this;
578
- $(function() {
578
+ j(function() {
579
579
  var o, i;
580
580
  if (n._throwIfClosed(), !n.isStopped) {
581
581
  n.currentObservers || (n.currentObservers = Array.from(n.observers));
@@ -597,7 +597,7 @@ var ze = (function(r) {
597
597
  });
598
598
  }, e.prototype.error = function(t) {
599
599
  var n = this;
600
- $(function() {
600
+ j(function() {
601
601
  if (n._throwIfClosed(), !n.isStopped) {
602
602
  n.hasError = n.isStopped = !0, n.thrownError = t;
603
603
  for (var o = n.observers; o.length; )
@@ -606,7 +606,7 @@ var ze = (function(r) {
606
606
  });
607
607
  }, e.prototype.complete = function() {
608
608
  var t = this;
609
- $(function() {
609
+ j(function() {
610
610
  if (t._throwIfClosed(), !t.isStopped) {
611
611
  t.isStopped = !0;
612
612
  for (var n = t.observers; n.length; )
@@ -629,7 +629,7 @@ var ze = (function(r) {
629
629
  }, e.prototype._innerSubscribe = function(t) {
630
630
  var n = this, o = this, i = o.hasError, s = o.isStopped, a = o.observers;
631
631
  return i || s ? ve : (this.currentObservers = null, a.push(t), new U(function() {
632
- n.currentObservers = null, j(a, t);
632
+ n.currentObservers = null, D(a, t);
633
633
  }));
634
634
  }, e.prototype._checkFinalizedStatuses = function(t) {
635
635
  var n = this, o = n.hasError, i = n.thrownError, s = n.isStopped;
@@ -743,7 +743,7 @@ var ze = (function(r) {
743
743
  }, e.prototype.unsubscribe = function() {
744
744
  if (!this.closed) {
745
745
  var t = this, n = t.id, o = t.scheduler, i = o.actions;
746
- this.work = this.state = this.scheduler = null, this.pending = !1, j(i, this), n != null && (this.id = this.recycleAsyncId(o, n, null)), this.delay = null, r.prototype.unsubscribe.call(this);
746
+ this.work = this.state = this.scheduler = null, this.pending = !1, D(i, this), n != null && (this.id = this.recycleAsyncId(o, n, null)), this.delay = null, r.prototype.unsubscribe.call(this);
747
747
  }
748
748
  }, e;
749
749
  })(et), ae = (function() {
@@ -790,10 +790,10 @@ function ge(r) {
790
790
  function it(r) {
791
791
  return m(ge(r)) ? r.pop() : void 0;
792
792
  }
793
- function we(r) {
793
+ function Se(r) {
794
794
  return be(ge(r)) ? r.pop() : void 0;
795
795
  }
796
- var Se = (function(r) {
796
+ var we = (function(r) {
797
797
  return r && typeof r.length == "number" && typeof r != "function";
798
798
  });
799
799
  function Ee(r) {
@@ -811,12 +811,12 @@ function Ae(r) {
811
811
  function st() {
812
812
  return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
813
813
  }
814
- var Te = st();
815
- function Ce(r) {
816
- return m(r?.[Te]);
814
+ var Ce = st();
815
+ function xe(r) {
816
+ return m(r?.[Ce]);
817
817
  }
818
- function _e(r) {
819
- return Ve(this, arguments, function() {
818
+ function Te(r) {
819
+ return Ge(this, arguments, function() {
820
820
  var t, n, o, i;
821
821
  return de(this, function(s) {
822
822
  switch (s.label) {
@@ -846,24 +846,24 @@ function _e(r) {
846
846
  });
847
847
  });
848
848
  }
849
- function xe(r) {
849
+ function _e(r) {
850
850
  return m(r?.getReader);
851
851
  }
852
- function C(r) {
852
+ function x(r) {
853
853
  if (r instanceof g)
854
854
  return r;
855
855
  if (r != null) {
856
856
  if (Ie(r))
857
857
  return at(r);
858
- if (Se(r))
858
+ if (we(r))
859
859
  return ct(r);
860
860
  if (Ee(r))
861
861
  return ut(r);
862
862
  if (Oe(r))
863
863
  return Pe(r);
864
- if (Ce(r))
865
- return lt(r);
866
864
  if (xe(r))
865
+ return lt(r);
866
+ if (_e(r))
867
867
  return ft(r);
868
868
  }
869
869
  throw Ae(r);
@@ -921,7 +921,7 @@ function Pe(r) {
921
921
  });
922
922
  }
923
923
  function ft(r) {
924
- return Pe(_e(r));
924
+ return Pe(Te(r));
925
925
  }
926
926
  function dt(r, e) {
927
927
  var t, n, o, i;
@@ -930,7 +930,7 @@ function dt(r, e) {
930
930
  return de(this, function(c) {
931
931
  switch (c.label) {
932
932
  case 0:
933
- c.trys.push([0, 5, 6, 11]), t = Ge(r), c.label = 1;
933
+ c.trys.push([0, 5, 6, 11]), t = He(r), c.label = 1;
934
934
  case 1:
935
935
  return [4, t.next()];
936
936
  case 2:
@@ -961,7 +961,7 @@ function dt(r, e) {
961
961
  });
962
962
  });
963
963
  }
964
- function T(r, e, t, n, o) {
964
+ function C(r, e, t, n, o) {
965
965
  n === void 0 && (n = 0), o === void 0 && (o = !1);
966
966
  var i = e.schedule(function() {
967
967
  t(), o ? r.add(this.schedule(null, n)) : this.unsubscribe();
@@ -970,34 +970,34 @@ function T(r, e, t, n, o) {
970
970
  return i;
971
971
  }
972
972
  function Me(r, e) {
973
- return e === void 0 && (e = 0), x(function(t, n) {
973
+ return e === void 0 && (e = 0), _(function(t, n) {
974
974
  t.subscribe(I(n, function(o) {
975
- return T(n, r, function() {
975
+ return C(n, r, function() {
976
976
  return n.next(o);
977
977
  }, e);
978
978
  }, function() {
979
- return T(n, r, function() {
979
+ return C(n, r, function() {
980
980
  return n.complete();
981
981
  }, e);
982
982
  }, function(o) {
983
- return T(n, r, function() {
983
+ return C(n, r, function() {
984
984
  return n.error(o);
985
985
  }, e);
986
986
  }));
987
987
  });
988
988
  }
989
989
  function Le(r, e) {
990
- return e === void 0 && (e = 0), x(function(t, n) {
990
+ return e === void 0 && (e = 0), _(function(t, n) {
991
991
  n.add(r.schedule(function() {
992
992
  return t.subscribe(n);
993
993
  }, e));
994
994
  });
995
995
  }
996
996
  function ht(r, e) {
997
- return C(r).pipe(Le(e), Me(e));
997
+ return x(r).pipe(Le(e), Me(e));
998
998
  }
999
999
  function vt(r, e) {
1000
- return C(r).pipe(Le(e), Me(e));
1000
+ return x(r).pipe(Le(e), Me(e));
1001
1001
  }
1002
1002
  function pt(r, e) {
1003
1003
  return new g(function(t) {
@@ -1010,8 +1010,8 @@ function pt(r, e) {
1010
1010
  function yt(r, e) {
1011
1011
  return new g(function(t) {
1012
1012
  var n;
1013
- return T(t, e, function() {
1014
- n = r[Te](), T(t, e, function() {
1013
+ return C(t, e, function() {
1014
+ n = r[Ce](), C(t, e, function() {
1015
1015
  var o, i, s;
1016
1016
  try {
1017
1017
  o = n.next(), i = o.value, s = o.done;
@@ -1030,9 +1030,9 @@ function Re(r, e) {
1030
1030
  if (!r)
1031
1031
  throw new Error("Iterable cannot be null");
1032
1032
  return new g(function(t) {
1033
- T(t, e, function() {
1033
+ C(t, e, function() {
1034
1034
  var n = r[Symbol.asyncIterator]();
1035
- T(t, e, function() {
1035
+ C(t, e, function() {
1036
1036
  n.next().then(function(o) {
1037
1037
  o.done ? t.complete() : t.next(o.value);
1038
1038
  });
@@ -1041,62 +1041,62 @@ function Re(r, e) {
1041
1041
  });
1042
1042
  }
1043
1043
  function mt(r, e) {
1044
- return Re(_e(r), e);
1044
+ return Re(Te(r), e);
1045
1045
  }
1046
1046
  function bt(r, e) {
1047
1047
  if (r != null) {
1048
1048
  if (Ie(r))
1049
1049
  return ht(r, e);
1050
- if (Se(r))
1050
+ if (we(r))
1051
1051
  return pt(r, e);
1052
1052
  if (Ee(r))
1053
1053
  return vt(r, e);
1054
1054
  if (Oe(r))
1055
1055
  return Re(r, e);
1056
- if (Ce(r))
1057
- return yt(r, e);
1058
1056
  if (xe(r))
1057
+ return yt(r, e);
1058
+ if (_e(r))
1059
1059
  return mt(r, e);
1060
1060
  }
1061
1061
  throw Ae(r);
1062
1062
  }
1063
1063
  function te(r, e) {
1064
- return e ? bt(r, e) : C(r);
1064
+ return e ? bt(r, e) : x(r);
1065
1065
  }
1066
1066
  function gt() {
1067
1067
  for (var r = [], e = 0; e < arguments.length; e++)
1068
1068
  r[e] = arguments[e];
1069
- var t = we(r);
1069
+ var t = Se(r);
1070
1070
  return te(r, t);
1071
1071
  }
1072
- function wt(r) {
1072
+ function St(r) {
1073
1073
  return r instanceof Date && !isNaN(r);
1074
1074
  }
1075
- function G(r, e) {
1076
- return x(function(t, n) {
1075
+ function H(r, e) {
1076
+ return _(function(t, n) {
1077
1077
  var o = 0;
1078
1078
  t.subscribe(I(n, function(i) {
1079
1079
  n.next(r.call(e, i, o++));
1080
1080
  }));
1081
1081
  });
1082
1082
  }
1083
- var St = Array.isArray;
1083
+ var wt = Array.isArray;
1084
1084
  function Et(r, e) {
1085
- return St(e) ? r.apply(void 0, R([], L(e))) : r(e);
1085
+ return wt(e) ? r.apply(void 0, R([], L(e))) : r(e);
1086
1086
  }
1087
1087
  function It(r) {
1088
- return G(function(e) {
1088
+ return H(function(e) {
1089
1089
  return Et(r, e);
1090
1090
  });
1091
1091
  }
1092
- var Ot = Array.isArray, At = Object.getPrototypeOf, Tt = Object.prototype, Ct = Object.keys;
1093
- function _t(r) {
1092
+ var Ot = Array.isArray, At = Object.getPrototypeOf, Ct = Object.prototype, xt = Object.keys;
1093
+ function Tt(r) {
1094
1094
  if (r.length === 1) {
1095
1095
  var e = r[0];
1096
1096
  if (Ot(e))
1097
1097
  return { args: e, keys: null };
1098
- if (xt(e)) {
1099
- var t = Ct(e);
1098
+ if (_t(e)) {
1099
+ var t = xt(e);
1100
1100
  return {
1101
1101
  args: t.map(function(n) {
1102
1102
  return e[n];
@@ -1107,8 +1107,8 @@ function _t(r) {
1107
1107
  }
1108
1108
  return { args: r, keys: null };
1109
1109
  }
1110
- function xt(r) {
1111
- return r && typeof r == "object" && At(r) === Tt;
1110
+ function _t(r) {
1111
+ return r && typeof r == "object" && At(r) === Ct;
1112
1112
  }
1113
1113
  function Pt(r, e) {
1114
1114
  return r.reduce(function(t, n, o) {
@@ -1118,16 +1118,16 @@ function Pt(r, e) {
1118
1118
  function Mt() {
1119
1119
  for (var r = [], e = 0; e < arguments.length; e++)
1120
1120
  r[e] = arguments[e];
1121
- var t = we(r), n = it(r), o = _t(r), i = o.args, s = o.keys;
1121
+ var t = Se(r), n = it(r), o = Tt(r), i = o.args, s = o.keys;
1122
1122
  if (i.length === 0)
1123
1123
  return te([], t);
1124
1124
  var a = new g(Lt(i, t, s ? function(c) {
1125
1125
  return Pt(s, c);
1126
- } : V));
1126
+ } : G));
1127
1127
  return n ? a.pipe(It(n)) : a;
1128
1128
  }
1129
1129
  function Lt(r, e, t) {
1130
- return t === void 0 && (t = V), function(n) {
1130
+ return t === void 0 && (t = G), function(n) {
1131
1131
  ce(e, function() {
1132
1132
  for (var o = r.length, i = new Array(o), s = o, a = o, c = function(f) {
1133
1133
  ce(e, function() {
@@ -1144,7 +1144,7 @@ function Lt(r, e, t) {
1144
1144
  };
1145
1145
  }
1146
1146
  function ce(r, e, t) {
1147
- r ? T(t, r, e) : e();
1147
+ r ? C(t, r, e) : e();
1148
1148
  }
1149
1149
  function Rt(r, e, t, n, o, i, s, a) {
1150
1150
  var c = [], u = 0, f = 0, h = !1, v = function() {
@@ -1153,23 +1153,23 @@ function Rt(r, e, t, n, o, i, s, a) {
1153
1153
  return u < n ? y(p) : c.push(p);
1154
1154
  }, y = function(p) {
1155
1155
  u++;
1156
- var w = !1;
1157
- C(t(p, f++)).subscribe(I(e, function(E) {
1158
- e.next(E);
1156
+ var S = !1;
1157
+ x(t(p, f++)).subscribe(I(e, function(w) {
1158
+ e.next(w);
1159
1159
  }, function() {
1160
- w = !0;
1160
+ S = !0;
1161
1161
  }, void 0, function() {
1162
- if (w)
1162
+ if (S)
1163
1163
  try {
1164
1164
  u--;
1165
- for (var E = function() {
1166
- var _ = c.shift();
1167
- s || y(_);
1165
+ for (var w = function() {
1166
+ var T = c.shift();
1167
+ s || y(T);
1168
1168
  }; c.length && u < n; )
1169
- E();
1169
+ w();
1170
1170
  v();
1171
- } catch (_) {
1172
- e.error(_);
1171
+ } catch (T) {
1172
+ e.error(T);
1173
1173
  }
1174
1174
  }));
1175
1175
  };
@@ -1180,10 +1180,10 @@ function Rt(r, e, t, n, o, i, s, a) {
1180
1180
  }
1181
1181
  function N(r, e, t) {
1182
1182
  return t === void 0 && (t = 1 / 0), m(e) ? N(function(n, o) {
1183
- return G(function(i, s) {
1183
+ return H(function(i, s) {
1184
1184
  return e(n, i, o, s);
1185
- })(C(r(n, o)));
1186
- }, t) : (typeof e == "number" && (t = e), x(function(n, o) {
1185
+ })(x(r(n, o)));
1186
+ }, t) : (typeof e == "number" && (t = e), _(function(n, o) {
1187
1187
  return Rt(n, o, r, t);
1188
1188
  }));
1189
1189
  }
@@ -1191,7 +1191,7 @@ function Ue(r, e, t) {
1191
1191
  r === void 0 && (r = 0), t === void 0 && (t = nt);
1192
1192
  var n = -1;
1193
1193
  return e != null && (be(e) ? t = e : n = e), new g(function(o) {
1194
- var i = wt(r) ? +r - t.now() : r;
1194
+ var i = St(r) ? +r - t.now() : r;
1195
1195
  i < 0 && (i = 0);
1196
1196
  var s = 0;
1197
1197
  return t.schedule(function() {
@@ -1205,27 +1205,27 @@ function Ut(r, e) {
1205
1205
  function kt(r) {
1206
1206
  return r <= 0 ? function() {
1207
1207
  return ot;
1208
- } : x(function(e, t) {
1208
+ } : _(function(e, t) {
1209
1209
  var n = 0;
1210
1210
  e.subscribe(I(t, function(o) {
1211
1211
  ++n <= r && (t.next(o), r <= n && t.complete());
1212
1212
  }));
1213
1213
  });
1214
1214
  }
1215
- function Dt(r) {
1216
- return G(function() {
1215
+ function $t(r) {
1216
+ return H(function() {
1217
1217
  return r;
1218
1218
  });
1219
1219
  }
1220
- function $t(r, e) {
1220
+ function jt(r, e) {
1221
1221
  return N(function(t, n) {
1222
- return C(r(t, n)).pipe(kt(1), Dt(t));
1222
+ return x(r(t, n)).pipe(kt(1), $t(t));
1223
1223
  });
1224
1224
  }
1225
- function jt(r, e) {
1225
+ function Dt(r, e) {
1226
1226
  e === void 0 && (e = me);
1227
1227
  var t = Ue(r, e);
1228
- return $t(function() {
1228
+ return jt(function() {
1229
1229
  return t;
1230
1230
  });
1231
1231
  }
@@ -1235,7 +1235,7 @@ function Nt(r) {
1235
1235
  count: r
1236
1236
  };
1237
1237
  var t = e.count, n = t === void 0 ? 1 / 0 : t, o = e.delay, i = e.resetOnSuccess, s = i === void 0 ? !1 : i;
1238
- return n <= 0 ? V : x(function(a, c) {
1238
+ return n <= 0 ? G : _(function(a, c) {
1239
1239
  var u = 0, f, h = function() {
1240
1240
  var v = !1;
1241
1241
  f = a.subscribe(I(c, function(l) {
@@ -1246,12 +1246,12 @@ function Nt(r) {
1246
1246
  f ? (f.unsubscribe(), f = null, h()) : v = !0;
1247
1247
  };
1248
1248
  if (o != null) {
1249
- var p = typeof o == "number" ? Ue(o) : C(o(l, u)), w = I(c, function() {
1250
- w.unsubscribe(), y();
1249
+ var p = typeof o == "number" ? Ue(o) : x(o(l, u)), S = I(c, function() {
1250
+ S.unsubscribe(), y();
1251
1251
  }, function() {
1252
1252
  c.complete();
1253
1253
  });
1254
- p.subscribe(w);
1254
+ p.subscribe(S);
1255
1255
  } else
1256
1256
  y();
1257
1257
  } else
@@ -1261,23 +1261,23 @@ function Nt(r) {
1261
1261
  h();
1262
1262
  });
1263
1263
  }
1264
- function Vt(r) {
1265
- return x(function(e, t) {
1266
- C(r).subscribe(I(t, function() {
1264
+ function Gt(r) {
1265
+ return _(function(e, t) {
1266
+ x(r).subscribe(I(t, function() {
1267
1267
  return t.complete();
1268
- }, Y)), !t.closed && e.subscribe(t);
1268
+ }, W)), !t.closed && e.subscribe(t);
1269
1269
  });
1270
1270
  }
1271
- async function Gt(r, e) {
1271
+ async function Ht(r, e) {
1272
1272
  const t = r.getReader();
1273
1273
  let n;
1274
1274
  for (; !(n = await t.read()).done; )
1275
1275
  e(n.value);
1276
1276
  }
1277
- function Ht(r) {
1277
+ function Ft(r) {
1278
1278
  let e, t, n, o = !1;
1279
1279
  return function(s) {
1280
- e === void 0 ? (e = s, t = 0, n = -1) : e = Ft(e, s);
1280
+ e === void 0 ? (e = s, t = 0, n = -1) : e = qt(e, s);
1281
1281
  const a = e.length;
1282
1282
  let c = 0;
1283
1283
  for (; t < a; ) {
@@ -1301,7 +1301,7 @@ function Ht(r) {
1301
1301
  c === a ? e = void 0 : c !== 0 && (e = e.subarray(c), t -= c);
1302
1302
  };
1303
1303
  }
1304
- function qt(r, e, t) {
1304
+ function Vt(r, e, t) {
1305
1305
  let n = ue();
1306
1306
  const o = new TextDecoder();
1307
1307
  return function(s, a) {
@@ -1328,7 +1328,7 @@ function qt(r, e, t) {
1328
1328
  }
1329
1329
  };
1330
1330
  }
1331
- function Ft(r, e) {
1331
+ function qt(r, e) {
1332
1332
  const t = new Uint8Array(r.length + e.length);
1333
1333
  return t.set(r), t.set(e, r.length), t;
1334
1334
  }
@@ -1349,48 +1349,48 @@ var Kt = function(r, e) {
1349
1349
  return t;
1350
1350
  };
1351
1351
  const J = "text/event-stream", Bt = 1e3, le = "last-event-id";
1352
- function Wt(r, e) {
1352
+ function Yt(r, e) {
1353
1353
  var { signal: t, headers: n, onopen: o, onmessage: i, onclose: s, onerror: a, openWhenHidden: c, fetch: u } = e, f = Kt(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
1354
1354
  return new Promise((h, v) => {
1355
1355
  const l = Object.assign({}, n);
1356
1356
  l.accept || (l.accept = J);
1357
1357
  let y;
1358
1358
  function p() {
1359
- y.abort(), document.hidden || H();
1359
+ y.abort(), document.hidden || F();
1360
1360
  }
1361
1361
  c || document.addEventListener("visibilitychange", p);
1362
- let w = Bt, E = 0;
1363
- function _() {
1364
- document.removeEventListener("visibilitychange", p), window.clearTimeout(E), y.abort();
1362
+ let S = Bt, w = 0;
1363
+ function T() {
1364
+ document.removeEventListener("visibilitychange", p), window.clearTimeout(w), y.abort();
1365
1365
  }
1366
1366
  t?.addEventListener("abort", () => {
1367
- _(), h();
1367
+ T(), h();
1368
1368
  });
1369
- const De = u ?? window.fetch, $e = o ?? Yt;
1370
- async function H() {
1371
- var q;
1369
+ const $e = u ?? window.fetch, je = o ?? Wt;
1370
+ async function F() {
1371
+ var V;
1372
1372
  y = new AbortController();
1373
1373
  try {
1374
- const k = await De(r, Object.assign(Object.assign({}, f), { headers: l, signal: y.signal }));
1375
- await $e(k), await Gt(k.body, Ht(qt((A) => {
1374
+ const k = await $e(r, Object.assign(Object.assign({}, f), { headers: l, signal: y.signal }));
1375
+ await je(k), await Ht(k.body, Ft(Vt((A) => {
1376
1376
  A ? l[le] = A : delete l[le];
1377
1377
  }, (A) => {
1378
- w = A;
1379
- }, i))), s?.(), _(), h();
1378
+ S = A;
1379
+ }, i))), s?.(), T(), h();
1380
1380
  } catch (k) {
1381
1381
  if (!y.signal.aborted)
1382
1382
  try {
1383
- const A = (q = a?.(k)) !== null && q !== void 0 ? q : w;
1384
- window.clearTimeout(E), E = window.setTimeout(H, A);
1383
+ const A = (V = a?.(k)) !== null && V !== void 0 ? V : S;
1384
+ window.clearTimeout(w), w = window.setTimeout(F, A);
1385
1385
  } catch (A) {
1386
- _(), v(A);
1386
+ T(), v(A);
1387
1387
  }
1388
1388
  }
1389
1389
  }
1390
- H();
1390
+ F();
1391
1391
  });
1392
1392
  }
1393
- function Yt(r) {
1393
+ function Wt(r) {
1394
1394
  const e = r.headers.get("content-type");
1395
1395
  if (!e?.startsWith(J))
1396
1396
  throw new Error(`Expected content-type to be ${J}, Actual: ${e}`);
@@ -1408,7 +1408,7 @@ function Xt(r) {
1408
1408
  const f = new URLSearchParams();
1409
1409
  o && f.set("is_debug", "true");
1410
1410
  const h = new URL(e);
1411
- return f.toString() && (h.search = f.toString()), Wt(h.toString(), {
1411
+ return f.toString() && (h.search = f.toString()), Yt(h.toString(), {
1412
1412
  method: "POST",
1413
1413
  headers: u,
1414
1414
  body: n ? JSON.stringify(n) : void 0,
@@ -1501,9 +1501,6 @@ class rr {
1501
1501
  case d.ERROR:
1502
1502
  this.sseEmitter.emit(d.ERROR, e);
1503
1503
  break;
1504
- case d.VIEW_UPDATE:
1505
- this.sseEmitter.emit(d.VIEW_UPDATE, e);
1506
- break;
1507
1504
  }
1508
1505
  }
1509
1506
  fetchSse(e, t) {
@@ -1514,8 +1511,8 @@ class rr {
1514
1511
  payload: this.transformSsePayload?.(e) ?? e,
1515
1512
  customHeaders: this.customHeaders
1516
1513
  }).pipe(
1517
- Ut((n) => gt(n).pipe(jt(t?.delayTime ?? 50))),
1518
- Vt(this.destroy$),
1514
+ Ut((n) => gt(n).pipe(Dt(t?.delayTime ?? 50))),
1515
+ Gt(this.destroy$),
1519
1516
  Nt(3)
1520
1517
  ).subscribe({
1521
1518
  next: (n) => {
@@ -1534,7 +1531,7 @@ class rr {
1534
1531
  }
1535
1532
  /**
1536
1533
  * 上傳檔案到 Blob API
1537
- * 根據 API 文件:/generic/ns/{namespace}/bot-provider/{bot_provider_name}/blob
1534
+ * 根據 API 文件:/ns/{namespace}/bot-provider/{bot_provider_name}/blob
1538
1535
  */
1539
1536
  async uploadFile(e, t) {
1540
1537
  const n = this.deriveBlobEndpoint();
@@ -1567,16 +1564,7 @@ class rr {
1567
1564
  if (!this.botProviderEndpoint && !this.endpoint)
1568
1565
  return null;
1569
1566
  let e = this.botProviderEndpoint;
1570
- if (!e && this.endpoint && (e = this.endpoint.replace("/message/sse", "")), !e)
1571
- return null;
1572
- if (e = e.replace(/\/+$/, ""), !e.includes("/generic/")) {
1573
- const t = e.match(/^(https?:\/\/[^/]+)(\/.*)/);
1574
- if (t) {
1575
- const [, n, o] = t;
1576
- e = `${n}/generic${o}`;
1577
- }
1578
- }
1579
- return `${e}/blob`;
1567
+ return !e && this.endpoint && (e = this.endpoint.replace("/message/sse", "")), e ? (e = e.replace(/\/+$/, ""), `${e}/blob`) : null;
1580
1568
  }
1581
1569
  }
1582
1570
  const b = [];
@@ -1606,14 +1594,14 @@ function tr(r, e, t) {
1606
1594
  function ke(r, e, t) {
1607
1595
  return fe.randomUUID && !r ? fe.randomUUID() : tr(r);
1608
1596
  }
1609
- class S {
1597
+ class E {
1610
1598
  messages = null;
1611
1599
  constructor({ messages: e }) {
1612
1600
  this.messages = e;
1613
1601
  }
1614
1602
  pushMessage(e) {
1615
1603
  const t = new Map(this.messages);
1616
- return t.set(e.messageId, e), new S({ messages: t });
1604
+ return t.set(e.messageId, e), new E({ messages: t });
1617
1605
  }
1618
1606
  onMessage(e) {
1619
1607
  switch (e.eventType) {
@@ -1629,8 +1617,6 @@ class S {
1629
1617
  return this.onToolCallComplete(e);
1630
1618
  case d.ERROR:
1631
1619
  return this.onMessageError(e);
1632
- case d.VIEW_UPDATE:
1633
- return this.onViewUpdate(e);
1634
1620
  default:
1635
1621
  return this;
1636
1622
  }
@@ -1647,7 +1633,7 @@ class S {
1647
1633
  time: /* @__PURE__ */ new Date(),
1648
1634
  traceId: e.traceId,
1649
1635
  raw: ""
1650
- }), new S({ messages: n });
1636
+ }), new E({ messages: n });
1651
1637
  }
1652
1638
  onMessageDelta(e) {
1653
1639
  const t = e.fact.messageDelta.message, n = new Map(this.messages), o = n.get(t.messageId);
@@ -1663,7 +1649,7 @@ class S {
1663
1649
  time: /* @__PURE__ */ new Date(),
1664
1650
  traceId: e.traceId ?? o.traceId,
1665
1651
  raw: o.raw
1666
- }), new S({ messages: n });
1652
+ }), new E({ messages: n });
1667
1653
  }
1668
1654
  onMessageComplete(e) {
1669
1655
  const t = e.fact.messageComplete.message, n = new Map(this.messages), o = n.get(t.messageId);
@@ -1677,7 +1663,7 @@ class S {
1677
1663
  time: /* @__PURE__ */ new Date(),
1678
1664
  traceId: e.traceId ?? (o?.type === "bot" ? o.traceId : void 0),
1679
1665
  raw: JSON.stringify(e)
1680
- }), new S({ messages: n });
1666
+ }), new E({ messages: n });
1681
1667
  }
1682
1668
  onMessageError(e) {
1683
1669
  const t = ke(), n = e.fact.runError.error, o = new Map(this.messages);
@@ -1688,7 +1674,7 @@ class S {
1688
1674
  error: n,
1689
1675
  time: /* @__PURE__ */ new Date(),
1690
1676
  traceId: e.traceId
1691
- }), new S({ messages: o });
1677
+ }), new E({ messages: o });
1692
1678
  }
1693
1679
  onToolCallStart(e) {
1694
1680
  const t = e.fact.toolCallStart, n = new Map(this.messages), o = `${t.processId}-${t.callSeq}`, i = {
@@ -1704,25 +1690,7 @@ class S {
1704
1690
  time: /* @__PURE__ */ new Date(),
1705
1691
  traceId: e.traceId
1706
1692
  };
1707
- return n.set(o, i), new S({ messages: n });
1708
- }
1709
- onViewUpdate(e) {
1710
- const t = e.fact.viewUpdate, n = new Map(this.messages), o = n.get(t.channelViewId), i = {
1711
- type: "view",
1712
- eventType: d.VIEW_UPDATE,
1713
- messageId: t.channelViewId,
1714
- requestId: e.requestId,
1715
- viewData: t,
1716
- sqlStatement: t.sqlStatement,
1717
- sqlExplanation: t.sqlExplanation,
1718
- previewData: t.previewData,
1719
- fullData: t.fullData,
1720
- visualSchemaChoices: t.visualSchemaChoices,
1721
- viewTitle: t.viewTitle,
1722
- time: o?.time ?? /* @__PURE__ */ new Date(),
1723
- traceId: e.traceId
1724
- };
1725
- return n.set(t.channelViewId, i), new S({ messages: n });
1693
+ return n.set(o, i), new E({ messages: n });
1726
1694
  }
1727
1695
  onToolCallComplete(e) {
1728
1696
  const t = e.fact.toolCallComplete, n = new Map(this.messages), o = `${t.processId}-${t.callSeq}`, i = n.get(o);
@@ -1736,7 +1704,7 @@ class S {
1736
1704
  };
1737
1705
  n.set(o, s);
1738
1706
  }
1739
- return new S({ messages: n });
1707
+ return new E({ messages: n });
1740
1708
  }
1741
1709
  }
1742
1710
  class z {
@@ -1769,7 +1737,7 @@ class z {
1769
1737
  }
1770
1738
  subscribe() {
1771
1739
  this.statesSubscription = Mt([this.isConnecting$, this.conversation$]).pipe(
1772
- G(([e, t]) => ({
1740
+ H(([e, t]) => ({
1773
1741
  isConnecting: e,
1774
1742
  conversation: t
1775
1743
  }))
@@ -1799,7 +1767,7 @@ class z {
1799
1767
  a && a.type === "user" && (s.set(this.currentUserMessageId, {
1800
1768
  ...a,
1801
1769
  traceId: i.traceId
1802
- }), this.conversation$.next(new S({ messages: s }))), this.currentUserMessageId = void 0;
1770
+ }), this.conversation$.next(new E({ messages: s }))), this.currentUserMessageId = void 0;
1803
1771
  }
1804
1772
  this.conversation$.next(this.conversation$.value.onMessage(i));
1805
1773
  },
@@ -1855,9 +1823,9 @@ class z {
1855
1823
  export {
1856
1824
  rr as AsgardServiceClient,
1857
1825
  z as Channel,
1858
- S as Conversation,
1826
+ E as Conversation,
1859
1827
  d as EventType,
1860
1828
  B as FetchSseAction,
1861
- je as MessageTemplateType
1829
+ De as MessageTemplateType
1862
1830
  };
1863
1831
  //# sourceMappingURL=index.mjs.map