@jboltai/tokui 0.2.2 → 0.2.3

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/tokui.mjs CHANGED
@@ -135,6 +135,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
135
135
  "agent.thinking": "思考",
136
136
  "agent.generating": "生成",
137
137
  "agent.total": "总计",
138
+ "agent.defaultName": "智能体",
139
+ "terminal.title": "终端",
140
+ "sandbox.title": "预览",
141
+ "canvas.title": "画布",
142
+ "toolCall.defaultName": "工具",
143
+ "artifact.codeTab": "代码",
144
+ "artifact.previewTab": "预览",
145
+ "testResult.total": "总计:{n}",
138
146
  "picker.noMatch": "无匹配项",
139
147
  "rate.defaultLabel": "评分",
140
148
  "select.placeholder": "请选择",
@@ -290,6 +298,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
290
298
  "agent.thinking": "Thinking",
291
299
  "agent.generating": "Generating",
292
300
  "agent.total": "Total",
301
+ "agent.defaultName": "Agent",
302
+ "terminal.title": "Terminal",
303
+ "sandbox.title": "Preview",
304
+ "canvas.title": "Canvas",
305
+ "toolCall.defaultName": "tool",
306
+ "artifact.codeTab": "Code",
307
+ "artifact.previewTab": "Preview",
308
+ "testResult.total": "Total: {n}",
293
309
  "bubble.you": "You",
294
310
  "bubble.ai": "AI",
295
311
  "bubble.system": "System",
@@ -658,7 +674,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
658
674
  "sub",
659
675
  "sup",
660
676
  "kbd"
661
- ]), d = new Set(/* @__PURE__ */ "stripe.dis.ro.req.chk.multi.disabled.readonly.required.checked.multiple.striped.auto.plain.round.closable.bordered.open.pill.dot.leaf.inline.rounded.container.copy.regenerate.like.dislike.visible.delete.controls.active.collapsible.toggle.search.thumb.reset.print.show-total.live.approval.streaming.range.half.sortable.filter.virtual.lazy.pagination.mask".split(".")), f = null;
677
+ ]), d = new Set(/* @__PURE__ */ "stripe.dis.ro.req.chk.multi.disabled.readonly.required.checked.multiple.striped.auto.plain.round.closable.bordered.open.pill.dot.leaf.inline.rounded.container.copy.regenerate.like.dislike.visible.delete.controls.active.collapsible.collapsed.toggle.search.thumb.reset.print.show-total.live.approval.streaming.range.half.sortable.filter.virtual.lazy.pagination.mask".split(".")), f = null;
662
678
  function p(e) {
663
679
  f = e;
664
680
  }
@@ -1366,7 +1382,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1366
1382
  kbd: new Set(["sm", "lg"])
1367
1383
  }, m = class {
1368
1384
  constructor(e) {
1369
- this.registry = {}, this.eventBus = e, this.slotStack = [], this._boundElements = [], this._onError = null, this._onComponentEvent = null;
1385
+ this.registry = {}, this.eventBus = e, this.slotStack = [], this._boundElements = [], this._cleanupElements = [], this._onError = null, this._onComponentEvent = null, this.streamAnimation = !0;
1386
+ }
1387
+ _streamFadeIn(e) {
1388
+ this.streamAnimation && (!e || e.nodeType !== 1 || this.slotStack.length > 0 || e.classList.add("tokui-fade-in"));
1370
1389
  }
1371
1390
  createReporter(e, t, n) {
1372
1391
  var r = this, i = c(t && t.on), a = t && t.id != null && t.id !== "" ? String(t.id) : null;
@@ -1460,7 +1479,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1460
1479
  let n = e._previewKey, r = this._pendingCharts[n];
1461
1480
  if (r) return r._tokuiChartUpdate && r._tokuiChartUpdate(e.attrs), r;
1462
1481
  let i = this.render(e), a = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null, o = a ? a.slot : t;
1463
- return i.nodeType === 1 && i.classList.add("tokui-fade-in"), o.appendChild(i), this._pendingCharts[n] = i, i;
1482
+ return this._streamFadeIn(i), o.appendChild(i), this._pendingCharts[n] = i, i;
1464
1483
  }
1465
1484
  _streamChartFinalize(e, t) {
1466
1485
  this._pendingCharts = this._pendingCharts || {};
@@ -1471,7 +1490,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1471
1490
  var n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null;
1472
1491
  n && n.el && (e._tbodyEl = n.el);
1473
1492
  var r = this.render(e, n ? n.containerType : void 0);
1474
- return r && r.nodeType === 1 && r.classList.add("tokui-fade-in"), (n ? n.slot : t).appendChild(r), this._trRegistry = this._trRegistry || {}, this._trRegistry[e._trKey] = r, r;
1493
+ return this._streamFadeIn(r), (n ? n.slot : t).appendChild(r), this._trRegistry = this._trRegistry || {}, this._trRegistry[e._trKey] = r, r;
1475
1494
  }
1476
1495
  _streamTrPreview(e) {
1477
1496
  this._trRegistry = this._trRegistry || {};
@@ -1486,7 +1505,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1486
1505
  _streamSkeletonPending(e, t) {
1487
1506
  this._pendingSkeletons = this._pendingSkeletons || {};
1488
1507
  var n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null, r = n ? n.slot : t, i = this._buildSkeleton(e.type);
1489
- return i && i.nodeType === 1 && i.classList.add("tokui-fade-in"), r && r.appendChild(i), this._pendingSkeletons[e._skelKey] = i, i;
1508
+ return this._streamFadeIn(i), r && r.appendChild(i), this._pendingSkeletons[e._skelKey] = i, i;
1490
1509
  }
1491
1510
  _streamSkeletonFinalize(e, t) {
1492
1511
  this._pendingSkeletons = this._pendingSkeletons || {};
@@ -1509,7 +1528,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1509
1528
  }
1510
1529
  _streamOpen(e, t) {
1511
1530
  let n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null, r = this.render(e, n ? n.containerType : void 0);
1512
- r && r.nodeType === 1 && (r._tokuiStreamActive = !0), r.nodeType === 1 && !r.classList.contains("tokui-hover-card__content-temp") && r.classList.add("tokui-fade-in");
1531
+ r && r.nodeType === 1 && (r._tokuiStreamActive = !0), r.nodeType === 1 && !r.classList.contains("tokui-hover-card__content-temp") && this._streamFadeIn(r);
1513
1532
  let i = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1].slot : t;
1514
1533
  if (e.type === "ft" && this.slotStack.length > 0) {
1515
1534
  let e = this.slotStack[this.slotStack.length - 1];
@@ -1558,7 +1577,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1558
1577
  var s = o.querySelector("input[type=radio]");
1559
1578
  s && (s.name = a);
1560
1579
  }
1561
- return o.nodeType === 1 && o.classList.add("tokui-fade-in"), i.appendChild(o), o;
1580
+ return this._streamFadeIn(o), i.appendChild(o), o;
1562
1581
  }
1563
1582
  if (e.type === "opt" && n && n.el._slot && n.el._slot._checkboxName) {
1564
1583
  var c = n.el._slot._checkboxName, l = this.render(e, "checkbox");
@@ -1566,7 +1585,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1566
1585
  var u = l.querySelector("input[type=checkbox]");
1567
1586
  u && (u.name = c);
1568
1587
  }
1569
- return l.nodeType === 1 && l.classList.add("tokui-fade-in"), i.appendChild(l), l;
1588
+ return this._streamFadeIn(l), i.appendChild(l), l;
1570
1589
  }
1571
1590
  if (e.type === "opt" && n && n.el._slot && n.el._slot._segmentedName) {
1572
1591
  var d = n.el._slot._segmentedName, f = this.render(e, "segmented");
@@ -1574,24 +1593,28 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1574
1593
  var p = f.querySelector("input[type=radio]");
1575
1594
  p && (p.name = d);
1576
1595
  }
1577
- return f.nodeType === 1 && f.classList.add("tokui-fade-in"), i.appendChild(f), f;
1596
+ return this._streamFadeIn(f), i.appendChild(f), f;
1578
1597
  }
1579
1598
  if (e.type === "opt" && n && n.containerType === "picker") {
1580
1599
  var m = n.slot, h = this.render(e, "picker");
1581
- h.nodeType === 1 && h.classList.add("tokui-fade-in");
1600
+ this._streamFadeIn(h);
1582
1601
  var g = m.querySelector(".tokui-picker-empty");
1583
1602
  return g ? m.insertBefore(h, g) : m.appendChild(h), h;
1584
1603
  }
1585
1604
  if (e.type === "opt" && n && n.containerType === "transfer" && n.el._tokuiTransferAppend) {
1586
1605
  var _ = n.el._tokuiTransferAppend(e);
1587
- return _ && _.nodeType === 1 && _.classList.add("tokui-fade-in"), null;
1606
+ return this._streamFadeIn(_), null;
1588
1607
  }
1589
1608
  if (e.type === "conv" && n && n.el && typeof n.el._renderConvChild == "function") {
1590
1609
  var v = n.el._renderConvChild(e);
1591
- return v && v.nodeType === 1 && v.classList.add("tokui-fade-in"), i.appendChild(v), v;
1610
+ return this._streamFadeIn(v), i.appendChild(v), v;
1611
+ }
1612
+ if (e.type === "_text") {
1613
+ var y = i.childNodes, b = y && y.length ? y[y.length - 1] : null, x;
1614
+ return b && b.nodeType === 3 ? (b.textContent += e.content, x = b) : (x = document.createTextNode(e.content), i.appendChild(x)), n && n.el && n.el._streamAppendHook && n.el._streamAppendHook(e), x;
1592
1615
  }
1593
- var y = this.render(e, r);
1594
- return y.nodeType === 1 && y.classList.add("tokui-fade-in"), i.appendChild(y), n && n.el && n.el._streamAppendHook && n.el._streamAppendHook(e), this.slotStack.length === 0 && this.bindEvents(y), y;
1616
+ var S = this.render(e, r);
1617
+ return this._streamFadeIn(S), i.appendChild(S), n && n.el && n.el._streamAppendHook && n.el._streamAppendHook(e), this.slotStack.length === 0 && this.bindEvents(S), S;
1595
1618
  }
1596
1619
  _collectFormData(e) {
1597
1620
  let t = {};
@@ -1622,8 +1645,17 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1622
1645
  let t = e.className && e.className.match && e.className.match(/tokui-(\w+)/);
1623
1646
  return t ? t[1] : "";
1624
1647
  }
1648
+ _registerCleanup(e, t) {
1649
+ !e || typeof t != "function" || (e._tokuiCleanupFns || (e._tokuiCleanupFns = [], this._cleanupElements.push(e)), e._tokuiCleanupFns.push(t));
1650
+ }
1625
1651
  destroy() {
1626
- this._boundElements.forEach(function(e) {
1652
+ this._cleanupElements.forEach(function(e) {
1653
+ (e._tokuiCleanupFns || []).forEach(function(e) {
1654
+ try {
1655
+ e();
1656
+ } catch {}
1657
+ }), delete e._tokuiCleanupFns;
1658
+ }), this._cleanupElements = [], this._boundElements.forEach(function(e) {
1627
1659
  e.listeners.forEach(function(t) {
1628
1660
  e.element.removeEventListener(t.type, t.fn);
1629
1661
  }), delete e.element._tokuiBound, delete e.element._tokuiClickBound;
@@ -5651,7 +5683,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
5651
5683
  sort: "<path d=\"M11 5h10\"/><path d=\"M11 9h7\"/><path d=\"M11 13h4\"/><path d=\"m3 17 3 3 3-3\"/><path d=\"M6 18V4\"/>",
5652
5684
  star: "<polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\"/>",
5653
5685
  link: "<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>",
5654
- menu: "<line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\"/>"
5686
+ menu: "<line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\"/>",
5687
+ sparkles: "<path d=\"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .962 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.962 0z\"/><path d=\"M20 3v4\"/><path d=\"M22 5h-4\"/><path d=\"M4 17v2\"/><path d=\"M5 18H3\"/>",
5688
+ lightbulb: "<path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\"/><path d=\"M9 18h6\"/><path d=\"M10 22h4\"/>",
5689
+ "chevron-right": "<path d=\"m9 18 6-6-6-6\"/>"
5655
5690
  };
5656
5691
  function r(e, t) {
5657
5692
  var r = n[e];
@@ -7927,7 +7962,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7927
7962
  var n = typeof l == "function" ? u().t : window.TokUI && window.TokUI._internal && window.TokUI._internal.t || function(e) {
7928
7963
  return e;
7929
7964
  };
7930
- function r(e) {
7965
+ function r(e, t) {
7966
+ if (typeof l == "function") try {
7967
+ return v().iconSvg(e, t);
7968
+ } catch {
7969
+ return "";
7970
+ }
7971
+ var n = typeof window < "u" && window.TokUI && window.TokUI._internal;
7972
+ return n && n.iconSvg ? n.iconSvg(e, t) : "";
7973
+ }
7974
+ function i(e) {
7931
7975
  if (!e) return null;
7932
7976
  let t = {
7933
7977
  primary: "var(--tokui-primary)",
@@ -7940,7 +7984,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7940
7984
  };
7941
7985
  return t[e] ? t[e] : /^[0-9a-fA-F]{6}$/.test(e) ? "#" + e : null;
7942
7986
  }
7943
- var i = {
7987
+ var a = {
7944
7988
  js: {
7945
7989
  keywords: /\b(abstract|arguments|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|eval|export|extends|finally|for|from|function|if|implements|import|in|instanceof|interface|let|new|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/g,
7946
7990
  types: /\b(Array|Boolean|Date|Error|Function|Infinity|JSON|Map|Math|NaN|Number|Object|Promise|RegExp|Set|String|Symbol|WeakMap|WeakSet|console|document|window|undefined|null|true|false|parseInt|parseFloat|isNaN|isFinite|require|module|exports|process|Buffer)\b/g
@@ -7994,8 +8038,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7994
8038
  shell: null,
7995
8039
  zsh: null
7996
8040
  };
7997
- Object.keys(i).forEach(function(e) {
7998
- if (i[e] === null) {
8041
+ Object.keys(a).forEach(function(e) {
8042
+ if (a[e] === null) {
7999
8043
  var t = {
8000
8044
  javascript: "js",
8001
8045
  jsx: "js",
@@ -8006,24 +8050,24 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8006
8050
  shell: "bash",
8007
8051
  zsh: "bash"
8008
8052
  }[e];
8009
- t && i[t] && (i[e] = i[t]);
8053
+ t && a[t] && (a[e] = a[t]);
8010
8054
  }
8011
8055
  });
8012
- function a(e, t) {
8056
+ function o(e, t) {
8013
8057
  if (!e) return "";
8014
- var n = String(e), r = i[t];
8058
+ var n = String(e), r = a[t];
8015
8059
  if (!r) return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8016
- var a = [], o = "\0PH_", s = "\0", c = /\x00PH_(\d+)\x00/g;
8060
+ var i = [], o = "\0PH_", s = "\0", c = /\x00PH_(\d+)\x00/g;
8017
8061
  function l() {
8018
- return o + String(a.length).padStart(5, "0") + s;
8062
+ return o + String(i.length).padStart(5, "0") + s;
8019
8063
  }
8020
8064
  function u(e, t) {
8021
8065
  var n = l(), r = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8022
- return a.push("<span class=\"tok-" + t + "\">" + r + "</span>"), n;
8066
+ return i.push("<span class=\"tok-" + t + "\">" + r + "</span>"), n;
8023
8067
  }
8024
8068
  function d(e, t) {
8025
8069
  var n = l();
8026
- return a.push("<span class=\"tok-" + t + "\">" + e + "</span>"), n;
8070
+ return i.push("<span class=\"tok-" + t + "\">" + e + "</span>"), n;
8027
8071
  }
8028
8072
  t === "json" && (n = n.replace(/(["'])(?:(?!\1|\\).|\\.)*\1(?=\s*:)/g, function(e) {
8029
8073
  return u(e, "type");
@@ -8040,7 +8084,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8040
8084
  })), n = n.replace(/\/\*[\s\S]*?\*\//g, function(e) {
8041
8085
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").split("\n").map(function(e) {
8042
8086
  var t = l();
8043
- return a.push("<span class=\"tok-cmt\">" + e + "</span>"), t;
8087
+ return i.push("<span class=\"tok-cmt\">" + e + "</span>"), t;
8044
8088
  }).join("\n");
8045
8089
  });
8046
8090
  var f = n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -8055,10 +8099,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8055
8099
  }), f = f.replace(/(&amp;&amp;|\|\||===|!==|=&gt;|\.\.\.|\+\+|--|[+\-*/%=!|^~?:]+)/g, function(e) {
8056
8100
  return d(e, "op");
8057
8101
  }), f = f.replace(c, function(e, t) {
8058
- return a[parseInt(t)];
8102
+ return i[parseInt(t)];
8059
8103
  }), f;
8060
8104
  }
8061
- function o(e) {
8105
+ function s(e) {
8062
8106
  var t = e === "sql", n = e !== "css" && e !== "html", r = {
8063
8107
  mode: "default",
8064
8108
  returnTo: "default"
@@ -8134,9 +8178,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8134
8178
  feed: a
8135
8179
  };
8136
8180
  }
8137
- function s(e) {
8181
+ function c(e) {
8138
8182
  let { el: t } = typeof l == "function" ? h() : window.TokUI._internal;
8139
- function s(e, t) {
8183
+ function c(e, t) {
8140
8184
  return t && typeof e.offsetLeft == "number" ? {
8141
8185
  kx: t.left - e.offsetLeft,
8142
8186
  ky: t.top - e.offsetTop
@@ -8154,10 +8198,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8154
8198
  "h6"
8155
8199
  ].forEach((n) => {
8156
8200
  e.register(n, (e) => {
8157
- let i = t(n, { class: `tokui-${n}` }, e.content || e.attrs && e.attrs.tx);
8158
- e.attrs && e.attrs.id && (i.id = e.attrs.id);
8159
- let a = r(e.attrs.bg), o = r(e.attrs.fc), s = e.attrs.v || "";
8160
- return a && (s.includes("underline") || s.includes("ribbon") || s.includes("badge") || s.includes("pill") ? i.style.setProperty("--tokui-title-bg", a) : i.style.background = a), o && (i.style.color = o), i;
8201
+ let r = t(n, { class: `tokui-${n}` }, e.content || e.attrs && e.attrs.tx);
8202
+ e.attrs && e.attrs.id && (r.id = e.attrs.id);
8203
+ let a = i(e.attrs.bg), o = i(e.attrs.fc), s = e.attrs.v || "";
8204
+ return a && (s.includes("underline") || s.includes("ribbon") || s.includes("badge") || s.includes("pill") ? r.style.setProperty("--tokui-title-bg", a) : r.style.background = a), o && (r.style.color = o), r;
8161
8205
  });
8162
8206
  }), e.register("p", (e, n) => {
8163
8207
  var r = { class: "tokui-p" };
@@ -8209,14 +8253,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8209
8253
  }), a;
8210
8254
  });
8211
8255
  }), e.register("tag", (e) => {
8212
- let i = e.attrs || {}, a = i.tx || e.content || "", o = ["tokui-tag"], s = i.t || "";
8256
+ let r = e.attrs || {}, a = r.tx || e.content || "", o = ["tokui-tag"], s = r.t || "";
8213
8257
  s && s !== "default" && o.push("tokui-tag--" + s);
8214
- let c = i.s || "";
8215
- c && c !== "medium" && o.push("tokui-tag--" + c), i.round !== void 0 && o.push("tokui-tag--round"), i.bordered !== void 0 && o.push("tokui-tag--bordered"), i.dis !== void 0 && o.push("tokui-tag--disabled");
8216
- let l = t("span", { class: o.join(" ") }), u = r(i.bg), d = r(i.fc);
8258
+ let c = r.s || "";
8259
+ c && c !== "medium" && o.push("tokui-tag--" + c), r.round !== void 0 && o.push("tokui-tag--round"), r.bordered !== void 0 && o.push("tokui-tag--bordered"), r.dis !== void 0 && o.push("tokui-tag--disabled");
8260
+ let l = t("span", { class: o.join(" ") }), u = i(r.bg), d = i(r.fc);
8217
8261
  u && (l.style.background = u), d && (l.style.color = d);
8218
8262
  let f = t("span", { class: "tokui-tag__content" });
8219
- if (f.textContent = a, l.appendChild(f), i.closable !== void 0) {
8263
+ if (f.textContent = a, l.appendChild(f), r.closable !== void 0) {
8220
8264
  o.push("tokui-tag--closable"), l.className = o.join(" ");
8221
8265
  let e = t("span", {
8222
8266
  class: "tokui-tag__close",
@@ -8341,18 +8385,18 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8341
8385
  }), n || (t.setAttribute("aria-checked", "true"), t.classList.add("tokui-toggle--pressed"));
8342
8386
  }), c._slot = c, c._tokuiType = "toggle-group", c;
8343
8387
  }), e.register("dv", (e) => {
8344
- let n = e.attrs || {}, i = n.tx || e.content || "", a = n.vert !== void 0, o = a ? "span" : "div", s = ["tokui-dv"];
8388
+ let n = e.attrs || {}, r = n.tx || e.content || "", a = n.vert !== void 0, o = a ? "span" : "div", s = ["tokui-dv"];
8345
8389
  if (n.v && s.push("tokui-dv--" + n.v), n.size && s.push("tokui-dv--" + n.size), a && s.push("tokui-dv--vert"), n.plain !== void 0 && s.push("tokui-dv--plain"), a) return t(o, { class: s.join(" ") });
8346
- if (i) {
8390
+ if (r) {
8347
8391
  s.push("tokui-dv--text");
8348
8392
  let e = n.align || "center";
8349
8393
  e !== "center" && s.push("tokui-dv--" + e);
8350
- let a = t(o, { class: s.join(" ") }), c = {}, l = r(n.bg);
8394
+ let a = t(o, { class: s.join(" ") }), c = {}, l = i(n.bg);
8351
8395
  l && (c.borderColor = l), n.th && (c.borderWidth = n.th), Object.keys(c).length && (c.borderColor && (a.style.borderColor = c.borderColor), c.borderWidth && (a.style.borderWidth = c.borderWidth));
8352
8396
  let u = t("span", { class: "tokui-dv-text" });
8353
- return u.textContent = i, a.appendChild(u), a;
8397
+ return u.textContent = r, a.appendChild(u), a;
8354
8398
  }
8355
- let c = t(o, { class: s.join(" ") }), l = {}, u = r(n.bg);
8399
+ let c = t(o, { class: s.join(" ") }), l = {}, u = i(n.bg);
8356
8400
  return u && (l.borderColor = u), n.th && (l.borderWidth = n.th), Object.keys(l).length && (l.borderColor && (c.style.borderColor = l.borderColor), l.borderWidth && (c.style.borderWidth = l.borderWidth)), c;
8357
8401
  }), e.register("progress", (e) => {
8358
8402
  let n = e.attrs || {}, r = Math.min(100, Math.max(0, parseInt(n.v) || 0)), i = n.l || "", a = n.t || "line", o = n.s || "", s = n.status || "", c = n.stripe !== void 0, l = "";
@@ -8406,15 +8450,15 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8406
8450
  e.status !== void 0 && (d.classList.remove("tokui-progress--success", "tokui-progress--error"), e.status === "success" ? d.classList.add("tokui-progress--success") : e.status === "error" && d.classList.add("tokui-progress--error"));
8407
8451
  }, d;
8408
8452
  });
8409
- function y(t) {
8453
+ function v(t) {
8410
8454
  var n = null, r = e._mountRoot;
8411
8455
  return r && typeof r.querySelector == "function" && (n = r.querySelector("[id=\"" + String(t).replace(/"/g, "\\\"") + "\"]")), n ||= document.getElementById(t), n;
8412
8456
  }
8413
- function b(t) {
8457
+ function x(t) {
8414
8458
  for (var n = t, r = e._mountRoot || null; n && !n._tokuiType && n.parentElement && n.parentElement !== r;) n = n.parentElement;
8415
8459
  return n || t;
8416
8460
  }
8417
- function x(t, n, r) {
8461
+ function S(t, n, r) {
8418
8462
  if (e._onComponentEvent) try {
8419
8463
  e._onComponentEvent({
8420
8464
  type: t,
@@ -8431,9 +8475,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8431
8475
  return e.trim();
8432
8476
  }).filter(Boolean), i = 0;
8433
8477
  r.forEach(function(e) {
8434
- for (var n = y(e); n && typeof n._update != "function";) n = n.parentElement;
8478
+ for (var n = v(e); n && typeof n._update != "function";) n = n.parentElement;
8435
8479
  n && typeof n._update == "function" && (n._update(t), i++);
8436
- }), x("upd", String(n), {
8480
+ }), S("upd", String(n), {
8437
8481
  applied: i > 0,
8438
8482
  targets: r.length,
8439
8483
  hits: i
@@ -8443,14 +8487,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8443
8487
  }), e.register("del", (t) => {
8444
8488
  var n = (t.attrs || {}).id;
8445
8489
  if (n && typeof document < "u") {
8446
- var r = !1, i = y(n);
8490
+ var r = !1, i = v(n);
8447
8491
  if (i) {
8448
- var a = b(i);
8492
+ var a = x(i);
8449
8493
  (e.slotStack || []).some(function(e) {
8450
8494
  return e.el === a || typeof a.contains == "function" && a.contains(e.el);
8451
8495
  }) ? console.warn("TokUI: del 目标 \"" + n + "\" 正在流式输出中(未闭合),已跳过;请在容器闭合后再发 del") : a.parentNode && (a.parentNode.removeChild(a), r = !0);
8452
8496
  }
8453
- x("del", String(n), { removed: r });
8497
+ S("del", String(n), { removed: r });
8454
8498
  }
8455
8499
  return document.createTextNode("");
8456
8500
  }), e.register("ins", (n, r) => {
@@ -8489,9 +8533,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8489
8533
  o = !0;
8490
8534
  var t = i.after || i.before || i.into, n = 0;
8491
8535
  if (t) {
8492
- var r = y(t);
8536
+ var r = v(t);
8493
8537
  if (r) {
8494
- var l = b(r), u, d;
8538
+ var l = x(r), u, d;
8495
8539
  if (i.into) {
8496
8540
  var f = l._tokuiType || "";
8497
8541
  c[f] ? console.warn("TokUI: ins into 不支持结构性容器 \"" + f + "\"(子节点有专用挂载协议),已跳过") : (u = l._slot || l, d = null);
@@ -8504,7 +8548,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8504
8548
  }
8505
8549
  }
8506
8550
  }
8507
- x("ins", String(t || ""), { moved: n });
8551
+ S("ins", String(t || ""), { moved: n });
8508
8552
  }
8509
8553
  }
8510
8554
  var u = t("span", {
@@ -8516,8 +8560,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8516
8560
  l(), u.parentNode && u.parentNode.removeChild(u);
8517
8561
  }, n.children && n.children.length && l(), u;
8518
8562
  });
8519
- function S(e, t) {
8520
- var n = m("mermaid");
8563
+ function C(e, t) {
8564
+ var n = _("mermaid");
8521
8565
  if (!(!n || !e) && (typeof t == "string" ? /```mermaid\n/.test(t) || typeof e.querySelector == "function" && e.querySelector(".tokui-md__mermaid") : String(e.innerHTML || "").indexOf("tokui-md__mermaid") !== -1 || typeof e.querySelector == "function" && e.querySelector(".tokui-md__mermaid"))) {
8522
8566
  var r = typeof e.querySelectorAll == "function" ? Array.prototype.slice.call(e.querySelectorAll(".tokui-md__mermaid")) : [], i = [];
8523
8567
  if (r.forEach(function(e) {
@@ -8534,12 +8578,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8534
8578
  } catch {}
8535
8579
  }
8536
8580
  }
8537
- typeof window < "u" && window.TokUI && window.TokUI._internal && (window.TokUI._internal.runMdMermaid = S, window.TokUI._internal.simpleMarkdown = v, window.TokUI._internal.renderKatexHtml = _), e.register("md", (e) => {
8581
+ typeof window < "u" && window.TokUI && window.TokUI._internal && (window.TokUI._internal.runMdMermaid = C, window.TokUI._internal.simpleMarkdown = b, window.TokUI._internal.renderKatexHtml = y), e.register("md", (e) => {
8538
8582
  let n = t("div", { class: "tokui-md" }), r = "";
8539
- return r = e.children && e.children.length > 0 ? e.children.map((e) => e.content || "").join("") : e.content || "", r && (n._rawMd = r, n.innerHTML = v(r), p(n), S(n, r)), n._streamCloseHook = function() {
8583
+ return r = e.children && e.children.length > 0 ? e.children.map((e) => e.content || "").join("") : e.content || "", r && (n._rawMd = r, n.innerHTML = b(r), m(n), C(n, r)), n._streamCloseHook = function() {
8540
8584
  let e = "";
8541
8585
  for (let t of Array.from(n.childNodes)) t.nodeType === 3 && (e += t.textContent);
8542
- e && (n._rawMd = e, n.innerHTML = v(e), p(n), S(n, e));
8586
+ e && (n._rawMd = e, n.innerHTML = b(e), m(n), C(n, e));
8543
8587
  }, n._tokuiType = "md", n;
8544
8588
  }), e.register("katex", (e) => {
8545
8589
  var n = e.attrs && e.attrs.f, r = !n, i = t("div", { class: "tokui-katex" + (r ? " tokui-katex--block" : " tokui-katex--inline") }), a = function() {
@@ -8547,10 +8591,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8547
8591
  return e.content || "";
8548
8592
  }).join("") : e.content || "");
8549
8593
  }();
8550
- return a && (i._rawMd = a, i.innerHTML = _(a, r)), i._streamCloseHook = function() {
8594
+ return a && (i._rawMd = a, i.innerHTML = y(a, r)), i._streamCloseHook = function() {
8551
8595
  var e = "";
8552
8596
  for (let t of Array.from(i.childNodes)) t.nodeType === 3 && (e += t.textContent);
8553
- e && (i._rawMd = e, i.innerHTML = _(e, !0));
8597
+ e && (i._rawMd = e, i.innerHTML = y(e, !0));
8554
8598
  }, i._slot = i, i._tokuiType = "katex", i;
8555
8599
  }), e.register("mermaid", (e) => {
8556
8600
  var n = t("div", { class: "tokui-mermaid" }), r = function() {
@@ -8560,7 +8604,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8560
8604
  }, i = function(e) {
8561
8605
  n.innerHTML = "";
8562
8606
  var r = t("div", { class: "tokui-md__mermaid" }), i = t("pre", { class: "tokui-code" }), a = t("code", { class: "language-mermaid" }, e);
8563
- i.appendChild(a), r.appendChild(i), n.appendChild(r), n._rawMd = e, S(n);
8607
+ i.appendChild(a), r.appendChild(i), n.appendChild(r), n._rawMd = e, C(n);
8564
8608
  }, a = r();
8565
8609
  return a && i(a), n._streamCloseHook = function() {
8566
8610
  var e = "";
@@ -8568,65 +8612,65 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8568
8612
  e && i(e);
8569
8613
  }, n._slot = n, n._tokuiType = "mermaid", n;
8570
8614
  });
8571
- function C(e) {
8615
+ function w(e) {
8572
8616
  return String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8573
8617
  }
8574
- function w(e) {
8618
+ function T(e) {
8575
8619
  return e.split("\n").map(function(e) {
8576
8620
  return "<span class=\"code-line\">" + (e || " ") + "</span>";
8577
8621
  }).join("");
8578
8622
  }
8579
- e.register("code", (e) => {
8580
- let r = t("pre", { class: "tokui-code" }), s = e.attrs.lang || "text", c = t("code", { class: `language-${s}` });
8581
- var l = "";
8582
- l = e.children && e.children.length > 0 ? e.children.map((e) => e.content || "").join("") : e.content || "";
8583
- var u = s !== "text" && i[s];
8584
- function d() {
8585
- c.innerHTML = w(u ? a(l, s) : C(l)), c._codeLineEls = null;
8623
+ e.register("code", (r) => {
8624
+ let i = t("pre", { class: "tokui-code" }), c = r.attrs.lang || "text", l = t("code", { class: `language-${c}` });
8625
+ var u = "";
8626
+ u = r.children && r.children.length > 0 ? r.children.map((e) => e.content || "").join("") : r.content || "";
8627
+ var d = c !== "text" && a[c];
8628
+ function f() {
8629
+ l.innerHTML = T(d ? o(u, c) : w(u)), l._codeLineEls = null;
8586
8630
  }
8587
- d(), r.appendChild(c), r._slot = c, r._tokuiType = "code";
8588
- var f = o(s), p = 0, m = 0, h = !1;
8589
- function g() {
8590
- if (h) {
8591
- d();
8631
+ f(), i.appendChild(l), i._slot = l, i._tokuiType = "code";
8632
+ var p = s(c), m = 0, h = 0, g = !1;
8633
+ function _() {
8634
+ if (g) {
8635
+ f();
8592
8636
  return;
8593
8637
  }
8594
- for (var e = l.split("\n"), n = e.length - 1, r = m; p < n;) f.feed(e[p]), p++, f.st.mode === "default" && (m = p);
8595
- var i = e.slice(r).join("\n"), o = (u ? a(i, s) : C(i)).split("\n");
8596
- if (o.length !== e.length - r) {
8597
- h = !0, d();
8638
+ for (var e = u.split("\n"), n = e.length - 1, r = h; m < n;) p.feed(e[m]), m++, p.st.mode === "default" && (h = m);
8639
+ var i = e.slice(r).join("\n"), a = (d ? o(i, c) : w(i)).split("\n");
8640
+ if (a.length !== e.length - r) {
8641
+ g = !0, f();
8598
8642
  return;
8599
8643
  }
8600
- for (var g = 0; g < o.length; g++) if (o[g].split("<span").length - 1 != o[g].split("</span>").length - 1) {
8601
- h = !0, d();
8644
+ for (var s = 0; s < a.length; s++) if (a[s].split("<span").length - 1 != a[s].split("</span>").length - 1) {
8645
+ g = !0, f();
8602
8646
  return;
8603
8647
  }
8604
- c._codeLineEls ||= (c.innerHTML = "", []);
8605
- for (var _ = c.childNodes; _.length > 0;) {
8648
+ l._codeLineEls ||= (l.innerHTML = "", []);
8649
+ for (var _ = l.childNodes; _.length > 0;) {
8606
8650
  var v = _[_.length - 1];
8607
8651
  if (!v || v.nodeType !== 3) break;
8608
- c.removeChild(v);
8652
+ l.removeChild(v);
8609
8653
  }
8610
- for (var y = c._codeLineEls; y.length < e.length;) {
8654
+ for (var y = l._codeLineEls; y.length < e.length;) {
8611
8655
  var b = t("span", { class: "code-line" });
8612
- y.push(b), c.appendChild(b);
8656
+ y.push(b), l.appendChild(b);
8613
8657
  }
8614
8658
  for (var x = r; x < e.length; x++) {
8615
- var S = o[x - r];
8659
+ var S = a[x - r];
8616
8660
  y[x].innerHTML = S === "" ? " " : S;
8617
8661
  }
8618
8662
  }
8619
- var _ = t("button", {
8663
+ var v = e.createReporter("code", r.attrs || {}, i), y = t("button", {
8620
8664
  class: "tokui-code__copy",
8621
8665
  type: "button"
8622
8666
  });
8623
- return _.textContent = n("common.copy"), _.addEventListener("click", function() {
8624
- l && navigator.clipboard && navigator.clipboard.writeText(l), _.textContent = n("common.copied"), _.classList.add("tokui-code__copy--done"), setTimeout(function() {
8625
- _.textContent = n("common.copy"), _.classList.remove("tokui-code__copy--done");
8667
+ return y.textContent = n("common.copy"), y.addEventListener("click", function() {
8668
+ u && navigator.clipboard && navigator.clipboard.writeText(u), y.textContent = n("common.copied"), y.classList.add("tokui-code__copy--done"), v("copy", {}), setTimeout(function() {
8669
+ y.textContent = n("common.copy"), y.classList.remove("tokui-code__copy--done");
8626
8670
  }, 2e3);
8627
- }), r.appendChild(_), r._streamAppendHook = function(e) {
8628
- e && e.type === "_text" && e.content && (l += e.content, g());
8629
- }, r._streamCloseHook = d, r;
8671
+ }), i.appendChild(y), i._streamAppendHook = function(e) {
8672
+ e && e.type === "_text" && e.content && (u += e.content, _());
8673
+ }, i._streamCloseHook = f, i;
8630
8674
  }), e.register("callout", (e, n) => {
8631
8675
  var r = e.attrs || {}, i = r.t || "info", a = r.tt || "", o = {
8632
8676
  info: "ℹ",
@@ -8650,44 +8694,76 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8650
8694
  var d = t("div", { class: "tokui-callout__content" }), f = e.children && e.children.length, p = r.tx || e.content || "";
8651
8695
  return f ? n(e.children).forEach(function(e) {
8652
8696
  e && e.nodeType && d.appendChild(e);
8653
- }) : p && (d.textContent = p), l.appendChild(d), s.appendChild(l), s._slot = d, s;
8654
- }), e.register("think", (e, r) => {
8655
- var i = e.attrs || {}, a = i.tt || n("think.title"), o = t("details", { class: "tokui-think" });
8656
- i.open !== void 0 && o.setAttribute("open", "");
8657
- var s = t("summary", { class: "tokui-think__summary" }), c = t("span", { class: "tokui-think__icon" });
8658
- c.textContent = "💭", s.appendChild(c);
8659
- var l = t("span", { class: "tokui-think__title" });
8660
- l.textContent = a, s.appendChild(l), o.appendChild(s);
8661
- var u = t("div", { class: "tokui-think__body" });
8662
- return e.content && (u.textContent = e.content), r(e.children || []).forEach(function(e) {
8663
- e && e.nodeType && u.appendChild(e);
8664
- }), o.appendChild(u), o._slot = u, o._tokuiType = "think", o;
8665
- }), e.register("think-chain", (e, r) => {
8666
- var i = e.attrs || {}, a = i.tt || n("thinkChain.title"), o = i.status || "", s = ["tokui-think-chain"];
8667
- o && s.push("tokui-think-chain--" + o);
8668
- var c = t("details", { class: s.join(" ") });
8669
- i.open !== void 0 && c.setAttribute("open", "");
8670
- var l = t("summary", { class: "tokui-think-chain__summary" }), u = t("span", { class: "tokui-think-chain__icon" });
8671
- u.textContent = "🧠", l.appendChild(u);
8672
- var d = t("span", { class: "tokui-think-chain__title" });
8673
- d.textContent = a, l.appendChild(d), c.appendChild(l);
8674
- var f = t("div", { class: "tokui-think-chain__steps" });
8675
- return r(e.children || []).forEach(function(e) {
8676
- e && e.nodeType && f.appendChild(e);
8677
- }), c.appendChild(f), c._slot = f, c._tokuiType = "think-chain", c;
8697
+ }) : p && (d.textContent = p), l.appendChild(d), s.appendChild(l), d._tokuiType = "callout", s._slot = d, s._tokuiType = "callout", s;
8698
+ }), e.register("think", (e, i) => {
8699
+ var a = e.attrs || {}, o = a.tt || n("think.title"), s = { class: "tokui-think" };
8700
+ a.id && (s.id = a.id);
8701
+ var c = t("details", s);
8702
+ a.open !== void 0 && c.setAttribute("open", "");
8703
+ var l = t("summary", { class: "tokui-think__summary" }), u = t("span", {
8704
+ class: "tokui-think__icon",
8705
+ "aria-hidden": "true"
8706
+ });
8707
+ u.innerHTML = r("lightbulb", 15), l.appendChild(u);
8708
+ var d = t("span", { class: "tokui-think__title" });
8709
+ d.textContent = o, l.appendChild(d);
8710
+ var f = t("span", {
8711
+ class: "tokui-think__chevron",
8712
+ "aria-hidden": "true"
8713
+ });
8714
+ f.innerHTML = r("chevron-right", 16), l.appendChild(f), c.appendChild(l);
8715
+ var p = t("div", { class: "tokui-think__body" });
8716
+ return e.content && (p.textContent = e.content), i(e.children || []).forEach(function(e) {
8717
+ e && e.nodeType && p.appendChild(e);
8718
+ }), c.appendChild(p), c._slot = p, c._tokuiType = "think", c;
8719
+ }), e.register("think-chain", (e, i) => {
8720
+ var a = e.attrs || {}, o = a.tt || n("thinkChain.title"), s = a.status || "", c = ["tokui-think-chain"];
8721
+ s && c.push("tokui-think-chain--" + s);
8722
+ var l = { class: c.join(" ") };
8723
+ a.id && (l.id = a.id);
8724
+ var u = t("details", l);
8725
+ a.open !== void 0 && u.setAttribute("open", "");
8726
+ var d = t("summary", { class: "tokui-think-chain__summary" }), f = t("span", {
8727
+ class: "tokui-think-chain__icon",
8728
+ "aria-hidden": "true"
8729
+ });
8730
+ f.innerHTML = r("sparkles", 15), d.appendChild(f);
8731
+ var p = t("span", { class: "tokui-think-chain__title" });
8732
+ p.textContent = o, d.appendChild(p);
8733
+ var m = t("span", {
8734
+ class: "tokui-think-chain__chevron",
8735
+ "aria-hidden": "true"
8736
+ });
8737
+ m.innerHTML = r("chevron-right", 16), d.appendChild(m), u.appendChild(d);
8738
+ var h = t("div", { class: "tokui-think-chain__steps" });
8739
+ return i(e.children || []).forEach(function(e) {
8740
+ e && e.nodeType && h.appendChild(e);
8741
+ }), u.appendChild(h), u._slot = h, u._tokuiType = "think-chain", u;
8678
8742
  }), e.register("think-step", (e, n) => {
8679
8743
  var r = e.attrs || {}, i = r.status || "pending", a = r.tt || "", o = r.dur || "", s = t("div", { class: ["tokui-think-step", "tokui-think-step--" + i].join(" ") }), c = t("div", { class: "tokui-think-step__header" });
8680
8744
  if (i === "done") {
8681
- var l = t("span", { class: "tokui-think-step__icon" });
8682
- l.textContent = "", c.appendChild(l);
8745
+ var l = t("span", {
8746
+ class: "tokui-think-step__icon",
8747
+ "aria-hidden": "true"
8748
+ });
8749
+ l.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6L9 17l-5-5\"/></svg>", c.appendChild(l);
8683
8750
  } else if (i === "running") {
8684
- var u = t("span", { class: "tokui-think-step__spinner" });
8751
+ var u = t("span", {
8752
+ class: "tokui-think-step__spinner",
8753
+ "aria-hidden": "true"
8754
+ });
8685
8755
  c.appendChild(u);
8686
- } else if (i === "error") {
8687
- var d = t("span", { class: "tokui-think-step__icon tokui-think-step__icon--error" });
8688
- d.textContent = "✗", c.appendChild(d);
8756
+ } else if (i === "error" || i === "danger") {
8757
+ var d = t("span", {
8758
+ class: "tokui-think-step__icon tokui-think-step__icon--" + i,
8759
+ "aria-hidden": "true"
8760
+ });
8761
+ d.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6L6 18\"/><path d=\"M6 6l12 12\"/></svg>", c.appendChild(d);
8689
8762
  } else {
8690
- var f = t("span", { class: "tokui-think-step__dot" });
8763
+ var f = t("span", {
8764
+ class: "tokui-think-step__dot",
8765
+ "aria-hidden": "true"
8766
+ });
8691
8767
  c.appendChild(f);
8692
8768
  }
8693
8769
  if (a) {
@@ -8705,21 +8781,23 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8705
8781
  }), s.appendChild(h);
8706
8782
  var g = t("div", { class: "tokui-think-step__line" });
8707
8783
  return s.appendChild(g), s._slot = h, s._tokuiType = "think-step", s;
8708
- }), e.register("copy", (e) => {
8709
- var r = e.attrs || {}, i = r.tx || n("common.copy"), a = r.tt || n("common.copied"), o = t("button", {
8784
+ }), e.register("copy", (r) => {
8785
+ var i = r.attrs || {}, a = i.tx || n("common.copy"), o = i.tt || n("common.copied"), s = t("button", {
8710
8786
  class: "tokui-copy",
8711
8787
  type: "button"
8712
8788
  });
8713
- return o.textContent = i, o.addEventListener("click", function() {
8789
+ s.textContent = a;
8790
+ var c = e.createReporter("copy", {}, s);
8791
+ return s.addEventListener("click", function() {
8714
8792
  var e = "";
8715
- if (r.id && typeof document < "u") {
8716
- var t = document.getElementById(r.id);
8793
+ if (i.id && typeof document < "u") {
8794
+ var t = document.getElementById(i.id);
8717
8795
  t && (e = t.textContent || "");
8718
8796
  }
8719
- navigator.clipboard && e && navigator.clipboard.writeText(e), o.textContent = a, o.classList.add("tokui-copy--done"), setTimeout(function() {
8720
- o.textContent = i, o.classList.remove("tokui-copy--done");
8797
+ navigator.clipboard && e && navigator.clipboard.writeText(e), s.textContent = o, s.classList.add("tokui-copy--done"), c("copy", {}), setTimeout(function() {
8798
+ s.textContent = a, s.classList.remove("tokui-copy--done");
8721
8799
  }, 2e3);
8722
- }), o;
8800
+ }), s;
8723
8801
  }), e.register("spin", (e) => {
8724
8802
  var n = e.attrs || {}, r = n.t || "spinner", i = n.s || "", a = n.tx || "", o = ["tokui-spin", "tokui-spin--" + r];
8725
8803
  i === "sm" || i === "small" ? o.push("tokui-spin--sm") : (i === "lg" || i === "large") && o.push("tokui-spin--lg");
@@ -8733,24 +8811,23 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8733
8811
  l.textContent = a, s.appendChild(l);
8734
8812
  }
8735
8813
  return s;
8736
- }), e.register("thumb", (e) => {
8737
- var r = e.attrs || {}, i = r.t || "up", a = r.v === "active", o = r.s || "", s = "";
8738
- o === "sm" || o === "small" ? s = " tokui-thumb--sm" : (o === "lg" || o === "large") && (s = " tokui-thumb--lg");
8739
- var c = t("button", {
8740
- class: "tokui-thumb tokui-thumb--" + i + (a ? " tokui-thumb--active" : "") + s,
8814
+ }), e.register("thumb", (r) => {
8815
+ var i = r.attrs || {}, a = i.t || "up", o = i.v === "active", s = i.s || "", c = "";
8816
+ s === "sm" || s === "small" ? c = " tokui-thumb--sm" : (s === "lg" || s === "large") && (c = " tokui-thumb--lg");
8817
+ var l = t("button", {
8818
+ class: "tokui-thumb tokui-thumb--" + a + (o ? " tokui-thumb--active" : "") + c,
8741
8819
  type: "button",
8742
- "aria-label": n(i === "up" ? "like.up" : "like.down"),
8743
- "aria-pressed": String(a)
8744
- }), l = o === "lg" || o === "large" ? 22 : o === "sm" || o === "small" ? 14 : 18, u = i === "up" ? "<svg viewBox=\"0 0 24 24\" width=\"" + l + "\" height=\"" + l + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"/></svg>" : "<svg viewBox=\"0 0 24 24\" width=\"" + l + "\" height=\"" + l + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"/></svg>", d = t("span", { class: "tokui-thumb__icon" });
8745
- return d.innerHTML = u, c.appendChild(d), c.addEventListener("click", function() {
8746
- if (c.classList.toggle("tokui-thumb--active"), c.setAttribute("aria-pressed", String(c.classList.contains("tokui-thumb--active"))), r.clk) {
8747
- var e = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
8748
- e && typeof e.emit == "function" && e.emit(r.clk, {
8749
- direction: i,
8750
- active: c.classList.contains("tokui-thumb--active")
8751
- });
8752
- }
8753
- }), c;
8820
+ "aria-label": n(a === "up" ? "like.up" : "like.down"),
8821
+ "aria-pressed": String(o)
8822
+ }), u = s === "lg" || s === "large" ? 22 : s === "sm" || s === "small" ? 14 : 18, d = a === "up" ? "<svg viewBox=\"0 0 24 24\" width=\"" + u + "\" height=\"" + u + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"/></svg>" : "<svg viewBox=\"0 0 24 24\" width=\"" + u + "\" height=\"" + u + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"/></svg>", f = t("span", { class: "tokui-thumb__icon" });
8823
+ f.innerHTML = d, l.appendChild(f);
8824
+ var p = e.createReporter("thumb", i, l);
8825
+ return l.addEventListener("click", function() {
8826
+ l.classList.toggle("tokui-thumb--active"), l.setAttribute("aria-pressed", String(l.classList.contains("tokui-thumb--active"))), i.clk && e.eventBus && typeof e.eventBus.emit == "function" && e.eventBus.emit(i.clk, {
8827
+ direction: a,
8828
+ active: l.classList.contains("tokui-thumb--active")
8829
+ }), p("like", { value: a });
8830
+ }), l;
8754
8831
  }), e.register("file", (e) => {
8755
8832
  var r = e.attrs || {}, i = r.n || n("file.unnamed"), a = r.s || "", o = r.t || "default", s = r.u || "", c = r.tt || "", l = {
8756
8833
  pdf: {
@@ -8824,22 +8901,24 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8824
8901
  }
8825
8902
  return d;
8826
8903
  }), e.register("bubble", (e, r) => {
8827
- var i = e.attrs || {}, a = i.role || "ai", o = i.model || "", s = i.time || "", c = t("div", { class: "tokui-bubble tokui-bubble--" + a }), l = t("div", { class: "tokui-bubble__row" }), u = t("span", { class: "tokui-bubble__avatar" });
8828
- u.textContent = n(a === "user" ? "bubble.you" : "bubble.ai"), l.appendChild(u);
8829
- var d = t("div", { class: "tokui-bubble__content" }), f = t("div", { class: "tokui-bubble__header" }), p = t("span", {});
8830
- if (p.textContent = n(a === "user" ? "bubble.you" : a === "system" ? "bubble.system" : "bubble.assistant"), f.appendChild(p), o) {
8831
- var m = t("span", { class: "tokui-badge tokui-badge--info tokui-badge--pill" });
8832
- m.textContent = o, f.appendChild(m);
8904
+ var i = e.attrs || {}, a = i.role || "ai", o = i.model || "", s = i.time || "", c = { class: "tokui-bubble tokui-bubble--" + a };
8905
+ i.id && (c.id = i.id);
8906
+ var l = t("div", c), u = t("div", { class: "tokui-bubble__row" }), d = t("span", { class: "tokui-bubble__avatar" });
8907
+ d.textContent = n(a === "user" ? "bubble.you" : "bubble.ai"), u.appendChild(d);
8908
+ var f = t("div", { class: "tokui-bubble__content" }), p = t("div", { class: "tokui-bubble__header" }), m = t("span", {});
8909
+ if (m.textContent = n(a === "user" ? "bubble.you" : a === "system" ? "bubble.system" : "bubble.assistant"), p.appendChild(m), o) {
8910
+ var h = t("span", { class: "tokui-badge tokui-badge--info tokui-badge--pill" });
8911
+ h.textContent = o, p.appendChild(h);
8833
8912
  }
8834
- d.appendChild(f);
8835
- var h = t("div", { class: "tokui-bubble__body" });
8913
+ f.appendChild(p);
8914
+ var g = t("div", { class: "tokui-bubble__body" });
8836
8915
  if (r(e.children || []).forEach(function(e) {
8837
- e && e.nodeType && h.appendChild(e);
8838
- }), d.appendChild(h), s) {
8839
- var g = t("div", { class: "tokui-bubble__time" });
8840
- g.textContent = s, d.appendChild(g);
8916
+ e && e.nodeType && g.appendChild(e);
8917
+ }), f.appendChild(g), s) {
8918
+ var _ = t("div", { class: "tokui-bubble__time" });
8919
+ _.textContent = s, f.appendChild(_);
8841
8920
  }
8842
- return l.appendChild(d), c.appendChild(l), h._slot = h, h._tokuiType = "bubble", c._slot = h, c._tokuiType = "bubble", c;
8921
+ return u.appendChild(f), l.appendChild(u), g._slot = g, g._tokuiType = "bubble", l._slot = g, l._tokuiType = "bubble", l;
8843
8922
  }), e.register("toolbar", (e, n) => {
8844
8923
  var r = e.attrs || {}, i = r.pos || "bottom", a = r.align || "right", o = t("div", { class: "tokui-toolbar tokui-toolbar--" + i + " tokui-toolbar--" + a });
8845
8924
  return n(e.children || []).forEach(function(e) {
@@ -8915,11 +8994,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8915
8994
  }
8916
8995
  return s;
8917
8996
  });
8918
- var T = null;
8997
+ var E = null;
8919
8998
  e.register("toast", (e) => {
8920
8999
  var n = e.attrs || {}, r = n.id || "", i = n.t || "info", a = n.tx || "", o = parseInt(n.duration, 10) || 2e3, s = n.pos || "top";
8921
- (!T || !T.parentNode) && (T = document.querySelector(".tokui-toast-container"), T || (T = t("div", { class: "tokui-toast-container" }), document.body.appendChild(T)));
8922
- var c = T, l = t("div", {
9000
+ (!E || !E.parentNode) && (E = document.querySelector(".tokui-toast-container"), E || (E = t("div", { class: "tokui-toast-container" }), document.body.appendChild(E)));
9001
+ var c = E, l = t("div", {
8923
9002
  class: "tokui-toast tokui-toast--" + i + (s === "bottom" ? " tokui-toast--bottom" : ""),
8924
9003
  role: "alert",
8925
9004
  "aria-live": "polite"
@@ -8959,11 +9038,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8959
9038
  }
8960
9039
  return s;
8961
9040
  }), e.register("avatar", (e) => {
8962
- var n = e.attrs || {}, i = n.s || "", a = n.tx || "", o = n.size || "md", s = ["tokui-avatar"];
8963
- if (i) {
9041
+ var n = e.attrs || {}, r = n.s || "", a = n.tx || "", o = n.size || "md", s = ["tokui-avatar"];
9042
+ if (r) {
8964
9043
  var c = t("img", {
8965
9044
  class: s.join(" "),
8966
- src: i,
9045
+ src: r,
8967
9046
  alt: a
8968
9047
  });
8969
9048
  return c.classList.add("tokui-avatar--" + o), c;
@@ -8973,7 +9052,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8973
9052
  l.textContent = a.slice(0, 2);
8974
9053
  var u = n.bg;
8975
9054
  if (u) {
8976
- var d = r(u);
9055
+ var d = i(u);
8977
9056
  d && (l.style.backgroundColor = d);
8978
9057
  } else if (a) {
8979
9058
  for (var f = [
@@ -8990,7 +9069,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8990
9069
  }
8991
9070
  var h = n.fc;
8992
9071
  if (h) {
8993
- var g = r(h);
9072
+ var g = i(h);
8994
9073
  g && (l.style.color = g);
8995
9074
  }
8996
9075
  return l;
@@ -9000,16 +9079,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9000
9079
  tabindex: "0"
9001
9080
  });
9002
9081
  o.textContent = a;
9003
- function c() {
9082
+ function s() {
9004
9083
  if (r && !o._tooltipEl) {
9005
9084
  var e = document.createElement("div");
9006
9085
  e.className = "tokui-tooltip__popup tokui-tooltip__popup--" + i, e.setAttribute("role", "tooltip");
9007
9086
  var t = "tokui-tip-" + Math.random().toString(36).slice(2, 8);
9008
9087
  e.id = t, o.setAttribute("aria-describedby", t), e.textContent = r, document.body.appendChild(e);
9009
- var n = o.getBoundingClientRect(), a = e.getBoundingClientRect(), c = 8, l, u;
9010
- i === "top" ? (l = n.left + n.width / 2 - a.width / 2, u = n.top - a.height - c) : i === "bottom" ? (l = n.left + n.width / 2 - a.width / 2, u = n.bottom + c) : i === "left" ? (l = n.left - a.width - c, u = n.top + n.height / 2 - a.height / 2) : i === "right" && (l = n.right + c, u = n.top + n.height / 2 - a.height / 2);
9011
- var d = s(e, a);
9012
- l + d.kx < 4 && (l = 4), l + d.kx + a.width > window.innerWidth - 4 && (l = window.innerWidth - a.width - 4), u + d.ky < 4 && (u = n.bottom + c), e.style.left = l + "px", e.style.top = u + "px", e.classList.add("tokui-tooltip__popup--visible"), o._tooltipEl = e;
9088
+ var n = o.getBoundingClientRect(), a = e.getBoundingClientRect(), s = 8, l, u;
9089
+ i === "top" ? (l = n.left + n.width / 2 - a.width / 2, u = n.top - a.height - s) : i === "bottom" ? (l = n.left + n.width / 2 - a.width / 2, u = n.bottom + s) : i === "left" ? (l = n.left - a.width - s, u = n.top + n.height / 2 - a.height / 2) : i === "right" && (l = n.right + s, u = n.top + n.height / 2 - a.height / 2);
9090
+ var d = c(e, a);
9091
+ l + d.kx < 4 && (l = 4), l + d.kx + a.width > window.innerWidth - 4 && (l = window.innerWidth - a.width - 4), u + d.ky < 4 && (u = n.bottom + s), e.style.left = l + "px", e.style.top = u + "px", e.classList.add("tokui-tooltip__popup--visible"), o._tooltipEl = e;
9013
9092
  }
9014
9093
  }
9015
9094
  function l() {
@@ -9021,14 +9100,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9021
9100
  }, 150), o._tooltipEl = null, o.removeAttribute("aria-describedby");
9022
9101
  }
9023
9102
  }
9024
- return o.addEventListener("mouseenter", c), o.addEventListener("focus", c), o.addEventListener("mouseleave", l), o.addEventListener("blur", l), o.addEventListener("keydown", function(e) {
9103
+ return o.addEventListener("mouseenter", s), o.addEventListener("focus", s), o.addEventListener("mouseleave", l), o.addEventListener("blur", l), o.addEventListener("keydown", function(e) {
9025
9104
  e.key === "Escape" && l();
9026
9105
  }), o;
9027
9106
  }), e.register("pagination", (r) => {
9028
- var i = r.attrs || {}, a = parseInt(i.total, 10) || 1, o = i.clk || "", s = i.s || "", c = i["show-total"] !== void 0, l = i.count || "", u = parseInt(i.page, 10) || 1, f = ["tokui-pagination"];
9029
- s === "sm" ? f.push("tokui-pagination--sm") : s === "lg" && f.push("tokui-pagination--lg");
9107
+ var i = r.attrs || {}, a = parseInt(i.total, 10) || 1, o = i.clk || "", s = i.s || "", c = i["show-total"] !== void 0, l = i.count || "", u = parseInt(i.page, 10) || 1, d = ["tokui-pagination"];
9108
+ s === "sm" ? d.push("tokui-pagination--sm") : s === "lg" && d.push("tokui-pagination--lg");
9030
9109
  var p = t("nav", {
9031
- class: f.join(" "),
9110
+ class: d.join(" "),
9032
9111
  role: "navigation",
9033
9112
  "aria-label": n("pagination.aria")
9034
9113
  });
@@ -9052,7 +9131,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9052
9131
  "aria-label": n("pagination.prev"),
9053
9132
  disabled: e <= 1
9054
9133
  });
9055
- o.textContent = "‹", h.appendChild(o), d(e, a).forEach(function(n) {
9134
+ o.textContent = "‹", h.appendChild(o), f(e, a).forEach(function(n) {
9056
9135
  if (n === "...") {
9057
9136
  var r = t("span", { class: "tokui-pagination__ellipsis" });
9058
9137
  r.textContent = "...", h.appendChild(r);
@@ -9137,7 +9216,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9137
9216
  }), s.appendChild(u), l.addEventListener("click", function(e) {
9138
9217
  e.stopPropagation();
9139
9218
  var t = u.classList.contains("tokui-dropdown__panel--open");
9140
- if (f(), !t) {
9219
+ if (p(), !t) {
9141
9220
  var n = l.getBoundingClientRect();
9142
9221
  u.style.top = n.bottom + 4 + "px", u.style.left = n.left + "px", u.classList.add("tokui-dropdown__panel--open"), l.setAttribute("aria-expanded", "true");
9143
9222
  }
@@ -9146,7 +9225,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9146
9225
  t && !t.classList.contains("tokui-dropdown__item--disabled") && (u.classList.remove("tokui-dropdown__panel--open"), l.setAttribute("aria-expanded", "false"));
9147
9226
  }), s._slot = u, s._tokuiType = "dropdown", l.addEventListener("keydown", function(e) {
9148
9227
  if (e.key === "ArrowDown" || e.key === "Enter") {
9149
- e.preventDefault(), u.classList.contains("tokui-dropdown__panel--open") || (f(), u.classList.add("tokui-dropdown__panel--open"), l.setAttribute("aria-expanded", "true"));
9228
+ e.preventDefault(), u.classList.contains("tokui-dropdown__panel--open") || (p(), u.classList.add("tokui-dropdown__panel--open"), l.setAttribute("aria-expanded", "true"));
9150
9229
  var t = u.querySelectorAll(".tokui-dropdown__item:not(.tokui-dropdown__item--disabled)");
9151
9230
  t.length > 0 && t[0].focus();
9152
9231
  }
@@ -9255,7 +9334,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9255
9334
  var o = t("div", a);
9256
9335
  return o.textContent = r, o;
9257
9336
  }), e.register("popover", (e, r) => {
9258
- var i = e.attrs || {}, a = i.tx || n("trigger.default"), o = i.pos || "top", c = i.tt || "", l = i.w || "", u = i.trig || "click", d = t("span", { class: "tokui-popover" }), f = t("span", {
9337
+ var i = e.attrs || {}, a = i.tx || n("trigger.default"), o = i.pos || "top", s = i.tt || "", l = i.w || "", u = i.trig || "click", d = t("span", { class: "tokui-popover" }), f = t("span", {
9259
9338
  class: "tokui-popover__trigger",
9260
9339
  tabindex: "0",
9261
9340
  role: "button",
@@ -9269,9 +9348,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9269
9348
  });
9270
9349
  l && (p.style.width = l);
9271
9350
  var m = t("div", { class: "tokui-popover__arrow" });
9272
- if (p.appendChild(m), c) {
9351
+ if (p.appendChild(m), s) {
9273
9352
  var h = t("div", { class: "tokui-popover__title" });
9274
- h.textContent = c, p.appendChild(h);
9353
+ h.textContent = s, p.appendChild(h);
9275
9354
  }
9276
9355
  var g = t("div", { class: "tokui-popover__body" });
9277
9356
  r(e.children || []).forEach(function(e) {
@@ -9280,7 +9359,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9280
9359
  function _() {
9281
9360
  var e = f.getBoundingClientRect(), t = p.getBoundingClientRect(), n = 10, r, i;
9282
9361
  o === "top" ? (r = e.left + e.width / 2 - t.width / 2, i = e.top - t.height - n) : o === "bottom" ? (r = e.left + e.width / 2 - t.width / 2, i = e.bottom + n) : o === "left" ? (r = e.left - t.width - n, i = e.top + e.height / 2 - t.height / 2) : o === "right" && (r = e.right + n, i = e.top + e.height / 2 - t.height / 2);
9283
- var a = s(p, t);
9362
+ var a = c(p, t);
9284
9363
  r + a.kx < 4 && (r = 4), r + a.kx + t.width > window.innerWidth - 4 && (r = window.innerWidth - t.width - 4), i + a.ky < 4 && (i = e.bottom + n), p.style.left = r + "px", p.style.top = i + "px";
9285
9364
  }
9286
9365
  function v() {
@@ -9306,7 +9385,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9306
9385
  e.key === "Escape" && (y(), typeof f.focus == "function" && f.focus());
9307
9386
  })), typeof window < "u" && window.addEventListener("scroll", y, !0), d._slot = g, d._tokuiType = "popover", d;
9308
9387
  }), e.register("hover-card", (e, n) => {
9309
- var r = e.attrs || {}, i = r.pos || "bottom", a = r.w || "", o = parseInt(r.delay) || 300, c = t("span", {
9388
+ var r = e.attrs || {}, i = r.pos || "bottom", a = r.w || "", o = parseInt(r.delay) || 300, s = t("span", {
9310
9389
  class: "tokui-hover-card tokui-hover-card--" + i,
9311
9390
  "data-delay": String(o)
9312
9391
  }), l = null, u = null;
@@ -9331,65 +9410,65 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9331
9410
  }), n([e]).forEach(function(e) {
9332
9411
  if (e && e.nodeType) if (e._tokuiType === "hover-trigger") for (; e.firstChild;) l.appendChild(e.firstChild);
9333
9412
  else l.appendChild(e);
9334
- }), c.appendChild(l);
9413
+ }), s.appendChild(l);
9335
9414
  else if (e.type === "hover-content") {
9336
9415
  var r = d();
9337
9416
  u = r.panel, n([e]).forEach(function(e) {
9338
9417
  if (e && e.nodeType) if (e._tokuiType === "hover-content") for (; e.firstChild;) r.body.appendChild(e.firstChild);
9339
9418
  else r.body.appendChild(e);
9340
- }), c.appendChild(u);
9419
+ }), s.appendChild(u);
9341
9420
  } else n([e]).forEach(function(e) {
9342
- e && e.nodeType && c.appendChild(e);
9421
+ e && e.nodeType && s.appendChild(e);
9343
9422
  });
9344
9423
  });
9345
9424
  function f(e) {
9346
- var t = c.querySelector(".tokui-hover-card__trigger");
9425
+ var t = s.querySelector(".tokui-hover-card__trigger");
9347
9426
  if (t) {
9348
9427
  var n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), a = 8, o, l;
9349
9428
  i === "bottom" ? (o = n.left + n.width / 2 - r.width / 2, l = n.bottom + a) : i === "top" ? (o = n.left + n.width / 2 - r.width / 2, l = n.top - r.height - a) : i === "left" ? (o = n.left - r.width - a, l = n.top + n.height / 2 - r.height / 2) : i === "right" && (o = n.right + a, l = n.top + n.height / 2 - r.height / 2);
9350
- var u = s(e, r);
9429
+ var u = c(e, r);
9351
9430
  o + u.kx < 4 && (o = 4), o + u.kx + r.width > window.innerWidth - 4 && (o = window.innerWidth - r.width - 4), l + u.ky < 4 && (l = n.bottom + a), e.style.left = o + "px", e.style.top = l + "px";
9352
9431
  }
9353
9432
  }
9354
9433
  var p = null, m = null;
9355
9434
  function h() {
9356
9435
  clearTimeout(m), p = setTimeout(function() {
9357
- var e = c.querySelector(".tokui-hover-card__content");
9436
+ var e = s.querySelector(".tokui-hover-card__content");
9358
9437
  e && (f(e), e.classList.add("tokui-hover-card__content--visible"));
9359
9438
  }, o);
9360
9439
  }
9361
9440
  function g() {
9362
9441
  clearTimeout(p), m = setTimeout(function() {
9363
- var e = c.querySelector(".tokui-hover-card__content");
9442
+ var e = s.querySelector(".tokui-hover-card__content");
9364
9443
  e && e.classList.remove("tokui-hover-card__content--visible");
9365
9444
  }, 150);
9366
9445
  }
9367
- return c.addEventListener("mouseenter", h), c.addEventListener("mouseleave", g), c.addEventListener("focusin", h), c.addEventListener("focusout", g), c.addEventListener("keydown", function(e) {
9446
+ return s.addEventListener("mouseenter", h), s.addEventListener("mouseleave", g), s.addEventListener("focusin", h), s.addEventListener("focusout", g), s.addEventListener("keydown", function(e) {
9368
9447
  if (e.key === "Escape") {
9369
9448
  clearTimeout(p), clearTimeout(m);
9370
- var t = c.querySelector(".tokui-hover-card__content");
9449
+ var t = s.querySelector(".tokui-hover-card__content");
9371
9450
  t && t.classList.remove("tokui-hover-card__content--visible");
9372
9451
  }
9373
- }), typeof window < "u" && window.addEventListener && window.addEventListener("scroll", g, !0), c._slot = c, c._tokuiType = "hover-card", c._streamCloseHook = function() {
9374
- for (var e = null, n = null, r = [], i = 0; i < c.children.length; i++) {
9375
- var a = c.children[i];
9452
+ }), typeof window < "u" && window.addEventListener && window.addEventListener("scroll", g, !0), s._slot = s, s._tokuiType = "hover-card", s._streamCloseHook = function() {
9453
+ for (var e = null, n = null, r = [], i = 0; i < s.children.length; i++) {
9454
+ var a = s.children[i];
9376
9455
  a._tokuiType === "hover-trigger" ? e = a : a._tokuiType === "hover-content" ? n = a : r.push(a);
9377
9456
  }
9378
9457
  if (!(!e && !n)) {
9379
- for (; c.firstChild;) c.removeChild(c.firstChild);
9458
+ for (; s.firstChild;) s.removeChild(s.firstChild);
9380
9459
  var o = t("span", {
9381
9460
  class: "tokui-hover-card__trigger",
9382
9461
  tabindex: "0"
9383
9462
  });
9384
9463
  if (e) for (; e.firstChild;) o.appendChild(e.firstChild);
9385
- c.appendChild(o);
9386
- var s = d();
9387
- if (n) for (; n.firstChild;) s.body.appendChild(n.firstChild);
9388
- c.appendChild(s.panel), r.forEach(function(e) {
9389
- c.appendChild(e);
9464
+ s.appendChild(o);
9465
+ var c = d();
9466
+ if (n) for (; n.firstChild;) c.body.appendChild(n.firstChild);
9467
+ s.appendChild(c.panel), r.forEach(function(e) {
9468
+ s.appendChild(e);
9390
9469
  });
9391
9470
  }
9392
- }, c;
9471
+ }, s;
9393
9472
  }), e.register("hover-trigger", (e, n) => {
9394
9473
  var r = t("span");
9395
9474
  return e.children && e.children.length > 0 && n(e.children).forEach(function(e) {
@@ -9561,7 +9640,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9561
9640
  var w = setInterval(C, 1e3);
9562
9641
  return m._countdownTimer = w, m._tokuiType = "countdown", m;
9563
9642
  }), e.register("popconfirm", (e) => {
9564
- var r = e.attrs || {}, i = r.tt || "", a = r.clk || "", o = r.t || "primary", c = r.pos || "top", l = r["ok-text"] || n("common.ok"), u = r["cancel-text"] || n("common.cancel"), d = e.content || r.tx || n("popconfirm.trigger"), f = t("span", { class: "tokui-popconfirm" }), p = t("button", {
9643
+ var r = e.attrs || {}, i = r.tt || "", a = r.clk || "", o = r.t || "primary", s = r.pos || "top", l = r["ok-text"] || n("common.ok"), u = r["cancel-text"] || n("common.cancel"), d = e.content || r.tx || n("popconfirm.trigger"), f = t("span", { class: "tokui-popconfirm" }), p = t("button", {
9565
9644
  class: "tokui-popconfirm__trigger",
9566
9645
  type: "button",
9567
9646
  tabindex: "0",
@@ -9581,7 +9660,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9581
9660
  function h() {
9582
9661
  m();
9583
9662
  var e = t("div", {
9584
- class: "tokui-popconfirm__popup tokui-popconfirm__popup--" + c,
9663
+ class: "tokui-popconfirm__popup tokui-popconfirm__popup--" + s,
9585
9664
  role: "dialog",
9586
9665
  "aria-label": i || n("popconfirm.aria")
9587
9666
  }), r = t("div", { class: "tokui-popconfirm__arrow" });
@@ -9612,8 +9691,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9612
9691
  function v() {
9613
9692
  if (p.getBoundingClientRect) {
9614
9693
  var t = p.getBoundingClientRect(), n = e.getBoundingClientRect(), r = 8, i, a;
9615
- c === "top" ? (i = t.left + t.width / 2 - n.width / 2, a = t.top - n.height - r) : c === "bottom" ? (i = t.left + t.width / 2 - n.width / 2, a = t.bottom + r) : c === "left" ? (i = t.left - n.width - r, a = t.top + t.height / 2 - n.height / 2) : c === "right" && (i = t.right + r, a = t.top + t.height / 2 - n.height / 2);
9616
- var o = s(e, n);
9694
+ s === "top" ? (i = t.left + t.width / 2 - n.width / 2, a = t.top - n.height - r) : s === "bottom" ? (i = t.left + t.width / 2 - n.width / 2, a = t.bottom + r) : s === "left" ? (i = t.left - n.width - r, a = t.top + t.height / 2 - n.height / 2) : s === "right" && (i = t.right + r, a = t.top + t.height / 2 - n.height / 2);
9695
+ var o = c(e, n);
9617
9696
  i + o.kx < 4 && (i = 4), i + o.kx + n.width > window.innerWidth - 4 && (i = window.innerWidth - n.width - 4), a + o.ky < 4 && (a = t.bottom + r), e.style.left = i + "px", e.style.top = a + "px";
9618
9697
  }
9619
9698
  e.classList.add("tokui-popconfirm__popup--visible");
@@ -9626,7 +9705,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9626
9705
  f._popconfirmPopup && !f._popconfirmPopup.contains(e.target) && !f.contains(e.target) && m();
9627
9706
  }), f.addEventListener("keydown", function(e) {
9628
9707
  e.key === "Escape" && m(!0);
9629
- }), typeof window < "u" && typeof window.addEventListener == "function" && window.addEventListener("scroll", m, !0), f._tokuiPopconfirmPos = c, f._tokuiType = "popconfirm", f;
9708
+ }), typeof window < "u" && typeof window.addEventListener == "function" && window.addEventListener("scroll", m, !0), f._tokuiPopconfirmPos = s, f._tokuiType = "popconfirm", f;
9630
9709
  }), e.register("watermark", (e, n) => {
9631
9710
  var r = e.attrs || {}, i = r.tx || "TokUI", a = r.font || (r.s === "sm" ? "12" : r.s === "lg" ? "20" : "16"), o = r.gap || "40", s = r.ro || "-22", c = r.c || "rgba(0,0,0,0.2)", l = t("div", { class: "tokui-watermark" });
9632
9711
  l.style.overflow = "hidden", l.style.borderRadius = "8px";
@@ -9646,56 +9725,56 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9646
9725
  l.appendChild(_);
9647
9726
  var y = t("div", { class: "tokui-watermark__overlay" });
9648
9727
  return y.style.backgroundImage = "url(" + u.toDataURL() + ")", y.style.backgroundRepeat = "repeat", y.style.borderRadius = "8px", l.appendChild(y), l._slot = _, l._tokuiType = "watermark", l;
9649
- }), e.register("backtop", (e) => {
9650
- var r = e.attrs || {}, i = parseInt(r.t) || 200, a = r.v || "circle", o = r.tx || "↑", s = r.s || "", c = r.bottom || "40", l = r.right || "40", u = r.container !== void 0, d = ["tokui-backtop"];
9651
- a === "round" ? d.push("tokui-backtop--round") : a === "square" && d.push("tokui-backtop--square"), s === "sm" ? d.push("tokui-backtop--sm") : s === "lg" && d.push("tokui-backtop--lg"), u && d.push("tokui-backtop--container");
9652
- var f = t("div", {
9653
- class: d.join(" "),
9728
+ }), e.register("backtop", (r) => {
9729
+ var i = r.attrs || {}, a = parseInt(i.t) || 200, o = i.v || "circle", s = i.tx || "↑", c = i.s || "", l = i.bottom || "40", u = i.right || "40", d = i.container !== void 0, f = ["tokui-backtop"];
9730
+ o === "round" ? f.push("tokui-backtop--round") : o === "square" && f.push("tokui-backtop--square"), c === "sm" ? f.push("tokui-backtop--sm") : c === "lg" && f.push("tokui-backtop--lg"), d && f.push("tokui-backtop--container");
9731
+ var p = t("div", {
9732
+ class: f.join(" "),
9654
9733
  role: "button",
9655
9734
  "aria-label": n("backToTop.aria"),
9656
9735
  tabindex: "0"
9657
9736
  });
9658
- return u ? f.style.bottom = c + "px" : (f.style.bottom = c + "px", f.style.right = l + "px"), f.textContent = o, typeof window < "u" && requestAnimationFrame(function() {
9659
- for (var e = window, t = f.parentElement; t;) {
9660
- var n = getComputedStyle(t);
9661
- if ((n.overflowY === "auto" || n.overflowY === "scroll") && t.scrollHeight > t.clientHeight) {
9662
- e = t;
9737
+ return d ? p.style.bottom = l + "px" : (p.style.bottom = l + "px", p.style.right = u + "px"), p.textContent = s, typeof window < "u" && requestAnimationFrame(function() {
9738
+ for (var t = window, n = p.parentElement; n;) {
9739
+ var r = getComputedStyle(n);
9740
+ if ((r.overflowY === "auto" || r.overflowY === "scroll") && n.scrollHeight > n.clientHeight) {
9741
+ t = n;
9663
9742
  break;
9664
9743
  }
9665
- t = t.parentElement;
9744
+ n = n.parentElement;
9666
9745
  }
9667
- f.addEventListener("click", function() {
9668
- e === window ? window.scrollTo({
9746
+ p.addEventListener("click", function() {
9747
+ t === window ? window.scrollTo({
9669
9748
  top: 0,
9670
9749
  behavior: "smooth"
9671
- }) : e.scrollTo({
9750
+ }) : t.scrollTo({
9672
9751
  top: 0,
9673
9752
  behavior: "smooth"
9674
9753
  });
9675
- }), f.addEventListener("keydown", function(t) {
9676
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e === window ? window.scrollTo({
9754
+ }), p.addEventListener("keydown", function(e) {
9755
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), t === window ? window.scrollTo({
9677
9756
  top: 0,
9678
9757
  behavior: "smooth"
9679
- }) : e.scrollTo({
9758
+ }) : t.scrollTo({
9680
9759
  top: 0,
9681
9760
  behavior: "smooth"
9682
9761
  }));
9683
9762
  });
9684
- var r = function() {
9685
- (e === window ? window.pageYOffset : e.scrollTop) > i ? f.classList.add("tokui-backtop--visible") : f.classList.remove("tokui-backtop--visible");
9686
- }, a = !1, o = function() {
9687
- a || (a = !0, (typeof window < "u" && window.requestAnimationFrame ? function(e) {
9763
+ var i = function() {
9764
+ (t === window ? window.pageYOffset : t.scrollTop) > a ? p.classList.add("tokui-backtop--visible") : p.classList.remove("tokui-backtop--visible");
9765
+ }, o = !1, s = function() {
9766
+ o || (o = !0, (typeof window < "u" && window.requestAnimationFrame ? function(e) {
9688
9767
  window.requestAnimationFrame(e);
9689
9768
  } : function(e) {
9690
9769
  e();
9691
9770
  })(function() {
9692
- a = !1, r();
9771
+ o = !1, i();
9693
9772
  }));
9694
9773
  };
9695
- e.addEventListener("scroll", o, { passive: !0 }), r(), f._backtopCleanup = function() {
9696
- e.removeEventListener("scroll", o);
9697
- };
9698
- }), f;
9774
+ t.addEventListener("scroll", s, { passive: !0 }), i(), p._backtopCleanup = function() {
9775
+ t.removeEventListener("scroll", s);
9776
+ }, e._registerCleanup(p, p._backtopCleanup);
9777
+ }), p;
9699
9778
  }), e.register("affix", (n, r) => {
9700
9779
  var i = n.attrs || {}, a = i.top === void 0 ? null : parseInt(i.top) || 0, o = i.bottom === void 0 ? null : parseInt(i.bottom) || 0;
9701
9780
  a === null && o === null && (a = 0);
@@ -9709,8 +9788,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9709
9788
  return e();
9710
9789
  };
9711
9790
  u(function() {
9712
- var e = null;
9713
- function n() {
9791
+ var n = null;
9792
+ function r() {
9714
9793
  if (s && typeof document < "u" && typeof document.querySelector == "function") {
9715
9794
  var e = document.querySelector(s);
9716
9795
  if (e) return e;
@@ -9724,13 +9803,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9724
9803
  }
9725
9804
  return null;
9726
9805
  }
9727
- var r = !1, i = null;
9728
- function d() {
9729
- if (e) {
9730
- var t = e.getBoundingClientRect();
9806
+ var i = !1, d = null;
9807
+ function f() {
9808
+ if (n) {
9809
+ var e = n.getBoundingClientRect();
9731
9810
  return {
9732
- top: t.top,
9733
- bottom: t.bottom
9811
+ top: e.top,
9812
+ bottom: e.bottom
9734
9813
  };
9735
9814
  }
9736
9815
  return {
@@ -9738,30 +9817,30 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9738
9817
  bottom: window.innerHeight || 768
9739
9818
  };
9740
9819
  }
9741
- var f = function() {
9820
+ var p = function() {
9742
9821
  if (typeof c.getBoundingClientRect == "function") {
9743
- (!s || !e) && (e = n());
9744
- var u = r && i ? i : c;
9745
- if (typeof u.getBoundingClientRect == "function") {
9746
- var f = u.getBoundingClientRect(), p = d(), m = a === null ? f.top > p.bottom - o - f.height : f.top - p.top < a;
9747
- if (m && !r) {
9748
- r = !0;
9822
+ (!s || !n) && (n = r());
9823
+ var e = i && d ? d : c;
9824
+ if (typeof e.getBoundingClientRect == "function") {
9825
+ var u = e.getBoundingClientRect(), p = f(), m = a === null ? u.top > p.bottom - o - u.height : u.top - p.top < a;
9826
+ if (m && !i) {
9827
+ i = !0;
9749
9828
  var h = c.getBoundingClientRect();
9750
- i = t("div", { class: "tokui-affix__placeholder" }), i.style.height = h.height + "px", i.style.width = h.width + "px", c.parentNode && c.parentNode.insertBefore(i, c), c.style.width = h.width + "px", c.style.top = a === null ? p.bottom - o - h.height + "px" : p.top + a + "px", c.classList.add("tokui-affix--fixed"), l("change", { fixed: !0 });
9751
- } else !m && r && (r = !1, c.classList.remove("tokui-affix--fixed"), c.style.top = "", c.style.width = "", i && i.parentNode && i.parentNode.removeChild(i), i = null, l("change", { fixed: !1 }));
9829
+ d = t("div", { class: "tokui-affix__placeholder" }), d.style.height = h.height + "px", d.style.width = h.width + "px", c.parentNode && c.parentNode.insertBefore(d, c), c.style.width = h.width + "px", c.style.top = a === null ? p.bottom - o - h.height + "px" : p.top + a + "px", c.classList.add("tokui-affix--fixed"), l("change", { fixed: !0 });
9830
+ } else !m && i && (i = !1, c.classList.remove("tokui-affix--fixed"), c.style.top = "", c.style.width = "", d && d.parentNode && d.parentNode.removeChild(d), d = null, l("change", { fixed: !1 }));
9752
9831
  }
9753
9832
  }
9754
- }, p = !1, m = function() {
9755
- p || (p = !0, u(function() {
9756
- p = !1, f();
9833
+ }, m = !1, h = function() {
9834
+ m || (m = !0, u(function() {
9835
+ m = !1, p();
9757
9836
  }));
9758
9837
  };
9759
- window.addEventListener && window.addEventListener("scroll", m, {
9838
+ window.addEventListener && window.addEventListener("scroll", h, {
9760
9839
  capture: !0,
9761
9840
  passive: !0
9762
- }), window.addEventListener && window.addEventListener("resize", m, { passive: !0 }), f(), c._streamCloseHook = f, c._affixCleanup = function() {
9763
- window.removeEventListener && (window.removeEventListener("scroll", m, { capture: !0 }), window.removeEventListener("resize", m));
9764
- };
9841
+ }), window.addEventListener && window.addEventListener("resize", h, { passive: !0 }), p(), c._streamCloseHook = p, c._affixCleanup = function() {
9842
+ window.removeEventListener && (window.removeEventListener("scroll", h, { capture: !0 }), window.removeEventListener("resize", h));
9843
+ }, e._registerCleanup(c, c._affixCleanup);
9765
9844
  });
9766
9845
  }
9767
9846
  return c;
@@ -9936,176 +10015,180 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9936
10015
  }
9937
10016
  return f._notifDuration = c, f;
9938
10017
  }), e.register("chat-input", (r, i) => {
9939
- var a = r.attrs || {}, o = a.ph || "", s = a.clk || "", c = a.dis !== void 0, l = parseInt(a.max) || 0, u = a.auto !== void 0, d = parseInt(a.rows) || 2, f = t("div", { class: "tokui-chat-input" }), p = t("textarea", {
10018
+ var a = r.attrs || {}, o = a.ph || "", s = a.clk || "", c = a.dis !== void 0, l = parseInt(a.max) || 0, u = a.auto !== void 0, d = parseInt(a.rows) || 2, f = { class: "tokui-chat-input" };
10019
+ a.id && (f.id = a.id);
10020
+ var p = t("div", f), m = t("textarea", {
9940
10021
  class: "tokui-chat-input__textarea",
9941
10022
  rows: String(d),
9942
10023
  placeholder: o
9943
10024
  });
9944
- c && (p.setAttribute("disabled", ""), p.classList.add("tokui-chat-input__textarea--disabled")), u && p.classList.add("tokui-chat-input__textarea--auto"), f.appendChild(p);
9945
- var m = t("div", { class: "tokui-chat-input__actions" });
10025
+ c && (m.setAttribute("disabled", ""), m.classList.add("tokui-chat-input__textarea--disabled")), u && m.classList.add("tokui-chat-input__textarea--auto"), p.appendChild(m);
10026
+ var h = t("div", { class: "tokui-chat-input__actions" });
9946
10027
  r.children && r.children.length > 0 && i(r.children).forEach(function(e) {
9947
- e && e.nodeType && m.appendChild(e);
10028
+ e && e.nodeType && h.appendChild(e);
9948
10029
  });
9949
- var h = t("button", {
10030
+ var g = t("button", {
9950
10031
  class: "tokui-chat-input__send",
9951
10032
  type: "button",
9952
10033
  "aria-label": n("common.send")
9953
10034
  });
9954
- h.innerHTML = "<svg viewBox=\"0 0 20 20\" width=\"18\" height=\"18\" fill=\"currentColor\"><path d=\"M10 3a1 1 0 0 1 .7.3l5 5a1 1 0 0 1-1.4 1.4L11 6.4V16a1 1 0 1 1-2 0V6.4l-3.3 3.3a1 1 0 0 1-1.4-1.4l5-5A1 1 0 0 1 10 3z\"/></svg>", c && (h.setAttribute("disabled", ""), h.classList.add("tokui-chat-input__send--disabled")), m.appendChild(h);
9955
- var g = e.createReporter("chat-input", a, f), _ = t("button", {
10035
+ g.innerHTML = "<svg viewBox=\"0 0 20 20\" width=\"18\" height=\"18\" fill=\"currentColor\"><path d=\"M10 3a1 1 0 0 1 .7.3l5 5a1 1 0 0 1-1.4 1.4L11 6.4V16a1 1 0 1 1-2 0V6.4l-3.3 3.3a1 1 0 0 1-1.4-1.4l5-5A1 1 0 0 1 10 3z\"/></svg>", c && (g.setAttribute("disabled", ""), g.classList.add("tokui-chat-input__send--disabled")), h.appendChild(g);
10036
+ var _ = e.createReporter("chat-input", a, p), v = t("button", {
9956
10037
  class: "tokui-chat-input__stop",
9957
10038
  type: "button",
9958
10039
  "aria-label": n("common.stop")
9959
10040
  });
9960
- if (_.innerHTML = "<svg viewBox=\"0 0 20 20\" width=\"18\" height=\"18\" fill=\"currentColor\"><rect x=\"5\" y=\"5\" width=\"10\" height=\"10\" rx=\"1.5\"/></svg>", _.addEventListener("click", function() {
9961
- if (g("stop", {}), f.classList.remove("tokui-chat-input--streaming"), !String(a.on || "").split(",").some(function(e) {
10041
+ if (v.innerHTML = "<svg viewBox=\"0 0 20 20\" width=\"18\" height=\"18\" fill=\"currentColor\"><rect x=\"5\" y=\"5\" width=\"10\" height=\"10\" rx=\"1.5\"/></svg>", v.addEventListener("click", function() {
10042
+ if (_("stop", {}), p.classList.remove("tokui-chat-input--streaming"), !String(a.on || "").split(",").some(function(e) {
9962
10043
  return e.trim().indexOf("stop:") === 0;
9963
10044
  })) {
9964
10045
  var t = e._tokuiInstance || typeof window < "u" && window.TokUI && window.TokUI._instance;
9965
10046
  t && typeof t.disconnect == "function" && t.disconnect();
9966
10047
  }
9967
- }), m.appendChild(_), a.streaming !== void 0 && f.classList.add("tokui-chat-input--streaming"), f.appendChild(m), l > 0) {
9968
- var v = t("span", { class: "tokui-chat-input__counter" });
9969
- v.textContent = "0/" + l, f.appendChild(v), p.addEventListener("input", function() {
9970
- var e = (p.value || "").length;
9971
- v.textContent = e + "/" + l, e > l ? v.classList.add("tokui-chat-input__counter--over") : v.classList.remove("tokui-chat-input__counter--over");
10048
+ }), h.appendChild(v), a.streaming !== void 0 && p.classList.add("tokui-chat-input--streaming"), p.appendChild(h), l > 0) {
10049
+ var y = t("span", { class: "tokui-chat-input__counter" });
10050
+ y.textContent = "0/" + l, p.appendChild(y), m.addEventListener("input", function() {
10051
+ var e = (m.value || "").length;
10052
+ y.textContent = e + "/" + l, e > l ? y.classList.add("tokui-chat-input__counter--over") : y.classList.remove("tokui-chat-input__counter--over");
9972
10053
  });
9973
10054
  }
9974
- u && p.addEventListener("input", function() {
9975
- p.style.height = "auto", p.style.height = p.scrollHeight + "px";
10055
+ u && m.addEventListener("input", function() {
10056
+ m.style.height = "auto", m.style.height = m.scrollHeight + "px";
9976
10057
  });
9977
- var y = a.mention || "";
9978
- if (y) {
9979
- p.setAttribute("role", "combobox"), p.setAttribute("aria-expanded", "false");
9980
- var b = t("div", {
10058
+ var b = a.mention || "";
10059
+ if (b) {
10060
+ m.setAttribute("role", "combobox"), m.setAttribute("aria-expanded", "false");
10061
+ var x = t("div", {
9981
10062
  class: "tokui-chat-input__mention",
9982
10063
  role: "listbox"
9983
10064
  });
9984
- b.style.display = "none", f.appendChild(b);
9985
- var x = [], S = -1, C = null, w = function() {
9986
- b.style.display = "none", x = [], S = -1, C = null, p.setAttribute("aria-expanded", "false");
9987
- }, T = function() {
9988
- var e = p.selectionStart == null ? (p.value || "").length : p.selectionStart, t = (p.value || "").slice(0, e).match(/(^|\s)@([^\s@]*)$/);
10065
+ x.style.display = "none", p.appendChild(x);
10066
+ var S = [], C = -1, w = null, T = function() {
10067
+ x.style.display = "none", S = [], C = -1, w = null, m.setAttribute("aria-expanded", "false");
10068
+ }, E = function() {
10069
+ var e = m.selectionStart == null ? (m.value || "").length : m.selectionStart, t = (m.value || "").slice(0, e).match(/(^|\s)@([^\s@]*)$/);
9989
10070
  return t ? {
9990
10071
  query: t[2],
9991
10072
  start: e - t[2].length - 1,
9992
10073
  end: e
9993
10074
  } : null;
9994
- }, E = function(e) {
9995
- var t = x[e];
9996
- if (!(!t || !C)) {
9997
- var n = typeof t == "string" ? t : t.v == null ? t.tx : t.v, r = typeof t == "string" ? t : t.tx == null ? t.v : t.tx, i = p.value || "";
9998
- p.value = i.slice(0, C.start) + "@" + r + " " + i.slice(C.end);
9999
- var o = C.start + String(r).length + 2;
10000
- typeof p.setSelectionRange == "function" && p.setSelectionRange(o, o), g("mention", {
10075
+ }, D = function(e) {
10076
+ var t = S[e];
10077
+ if (!(!t || !w)) {
10078
+ var n = typeof t == "string" ? t : t.v == null ? t.tx : t.v, r = typeof t == "string" ? t : t.tx == null ? t.v : t.tx, i = m.value || "";
10079
+ m.value = i.slice(0, w.start) + "@" + r + " " + i.slice(w.end);
10080
+ var o = w.start + String(r).length + 2;
10081
+ typeof m.setSelectionRange == "function" && m.setSelectionRange(o, o), _("mention", {
10001
10082
  value: n,
10002
10083
  name: a.n || void 0
10003
- }), w(), typeof p.focus == "function" && p.focus();
10084
+ }), T(), typeof m.focus == "function" && m.focus();
10004
10085
  }
10005
- }, D = function(e) {
10006
- if (b.innerHTML = "", x = e.slice(0, 8), !x.length) {
10007
- w();
10086
+ }, O = function(e) {
10087
+ if (x.innerHTML = "", S = e.slice(0, 8), !S.length) {
10088
+ T();
10008
10089
  return;
10009
10090
  }
10010
- S = 0, x.forEach(function(e, n) {
10091
+ C = 0, S.forEach(function(e, n) {
10011
10092
  var r = typeof e == "string" ? e : e.tx == null ? e.v : e.tx, i = t("div", {
10012
10093
  class: "tokui-chat-input__mention-item" + (n === 0 ? " tokui-chat-input__mention-item--active" : ""),
10013
10094
  role: "option",
10014
10095
  "aria-selected": n === 0 ? "true" : "false"
10015
10096
  }, r);
10016
10097
  i.addEventListener("mousedown", function(e) {
10017
- e && e.preventDefault && e.preventDefault(), E(n);
10018
- }), b.appendChild(i);
10019
- }), b.style.display = "", p.setAttribute("aria-expanded", "true");
10098
+ e && e.preventDefault && e.preventDefault(), D(n);
10099
+ }), x.appendChild(i);
10100
+ }), x.style.display = "", m.setAttribute("aria-expanded", "true");
10020
10101
  };
10021
- p.addEventListener("keydown", function(e) {
10022
- if (b.style.display !== "none") if (e.key === "ArrowDown" || e.key === "ArrowUp") {
10023
- e.preventDefault && e.preventDefault(), e._tokuiMentionHandled = !0, S = (S + (e.key === "ArrowDown" ? 1 : -1) + x.length) % x.length;
10024
- for (var t = 0; t < b.childNodes.length; t++) {
10025
- var n = b.childNodes[t];
10026
- n.classList && (t === S ? (n.classList.add("tokui-chat-input__mention-item--active"), n.setAttribute("aria-selected", "true")) : (n.classList.remove("tokui-chat-input__mention-item--active"), n.setAttribute("aria-selected", "false")));
10102
+ m.addEventListener("keydown", function(e) {
10103
+ if (x.style.display !== "none") if (e.key === "ArrowDown" || e.key === "ArrowUp") {
10104
+ e.preventDefault && e.preventDefault(), e._tokuiMentionHandled = !0, C = (C + (e.key === "ArrowDown" ? 1 : -1) + S.length) % S.length;
10105
+ for (var t = 0; t < x.childNodes.length; t++) {
10106
+ var n = x.childNodes[t];
10107
+ n.classList && (t === C ? (n.classList.add("tokui-chat-input__mention-item--active"), n.setAttribute("aria-selected", "true")) : (n.classList.remove("tokui-chat-input__mention-item--active"), n.setAttribute("aria-selected", "false")));
10027
10108
  }
10028
- } else e.key === "Enter" || e.key === "Tab" ? (e.preventDefault && e.preventDefault(), e._tokuiMentionHandled = !0, E(S)) : e.key === "Escape" && (e._tokuiMentionHandled = !0, w());
10029
- }), p.addEventListener("input", function() {
10030
- var t = T();
10109
+ } else e.key === "Enter" || e.key === "Tab" ? (e.preventDefault && e.preventDefault(), e._tokuiMentionHandled = !0, D(C)) : e.key === "Escape" && (e._tokuiMentionHandled = !0, T());
10110
+ }), m.addEventListener("input", function() {
10111
+ var t = E();
10031
10112
  if (!t) {
10032
- w();
10113
+ T();
10033
10114
  return;
10034
10115
  }
10035
10116
  if (e.eventBus) {
10036
- var n = e.eventBus.getHandler(y);
10117
+ var n = e.eventBus.getHandler(b);
10037
10118
  if (!n) {
10038
- e._warnMissingHandler(y), w();
10119
+ e._warnMissingHandler(b), T();
10039
10120
  return;
10040
10121
  }
10041
- C = t;
10122
+ w = t;
10042
10123
  var r;
10043
10124
  try {
10044
10125
  r = n({ value: t.query });
10045
10126
  } catch (e) {
10046
- console.warn("TokUI: mention 数据源异常", e), w();
10127
+ console.warn("TokUI: mention 数据源异常", e), T();
10047
10128
  return;
10048
10129
  }
10049
10130
  r && typeof r.then == "function" ? r.then(function(e) {
10050
- C && C.query === t.query && Array.isArray(e) && D(e);
10131
+ w && w.query === t.query && Array.isArray(e) && O(e);
10051
10132
  }).catch(function() {
10052
- w();
10053
- }) : Array.isArray(r) ? D(r) : w();
10133
+ T();
10134
+ }) : Array.isArray(r) ? O(r) : T();
10054
10135
  }
10055
- }), p.addEventListener("blur", function() {
10056
- setTimeout(w, 150);
10136
+ }), m.addEventListener("blur", function() {
10137
+ setTimeout(T, 150);
10057
10138
  });
10058
10139
  }
10059
- function O() {
10140
+ function k() {
10060
10141
  if (!c) {
10061
- var t = p.value || "";
10142
+ var t = m.value || "";
10062
10143
  if (t.trim()) {
10063
- if (s && (f.setAttribute("data-tokui-clk-value", t), e.eventBus)) {
10144
+ if (s && (p.setAttribute("data-tokui-clk-value", t), e.eventBus)) {
10064
10145
  var n = e.eventBus.getHandler(s);
10065
- n ? n({ value: t }, null, f) : e._warnMissingHandler(s);
10146
+ n ? n({ value: t }, null, p) : e._warnMissingHandler(s);
10066
10147
  }
10067
- g("send", { value: t }), p.value = "", l > 0 && (v.textContent = "0/" + l, v.classList.remove("tokui-chat-input__counter--over")), u && (p.style.height = "auto");
10148
+ _("send", { value: t }), m.value = "", l > 0 && (y.textContent = "0/" + l, y.classList.remove("tokui-chat-input__counter--over")), u && (m.style.height = "auto");
10068
10149
  }
10069
10150
  }
10070
10151
  }
10071
- return p.addEventListener("keydown", function(e) {
10072
- e._tokuiMentionHandled || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), O());
10073
- }), h.addEventListener("click", function() {
10074
- O();
10075
- }), f._update = function(e) {
10076
- e.dis !== void 0 && (c = !!e.dis, c ? (p.setAttribute("disabled", ""), p.classList.add("tokui-chat-input__textarea--disabled"), h.setAttribute("disabled", ""), h.classList.add("tokui-chat-input__send--disabled")) : (p.removeAttribute("disabled"), p.classList.remove("tokui-chat-input__textarea--disabled"), h.removeAttribute("disabled"), h.classList.remove("tokui-chat-input__send--disabled"))), e.streaming !== void 0 && (e.streaming !== "false" && e.streaming !== !1 ? f.classList.add("tokui-chat-input--streaming") : f.classList.remove("tokui-chat-input--streaming"));
10077
- }, f._slot = p, f._tokuiType = "chat-input", f;
10152
+ return m.addEventListener("keydown", function(e) {
10153
+ e._tokuiMentionHandled || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), k());
10154
+ }), g.addEventListener("click", function() {
10155
+ k();
10156
+ }), p._update = function(e) {
10157
+ e.dis !== void 0 && (c = e.dis !== "false" && e.dis !== !1, c ? (m.setAttribute("disabled", ""), m.classList.add("tokui-chat-input__textarea--disabled"), g.setAttribute("disabled", ""), g.classList.add("tokui-chat-input__send--disabled")) : (m.removeAttribute("disabled"), m.classList.remove("tokui-chat-input__textarea--disabled"), g.removeAttribute("disabled"), g.classList.remove("tokui-chat-input__send--disabled"))), e.streaming !== void 0 && (e.streaming !== "false" && e.streaming !== !1 ? p.classList.add("tokui-chat-input--streaming") : p.classList.remove("tokui-chat-input--streaming"));
10158
+ }, p._slot = h, p._tokuiType = "chat-input", p;
10078
10159
  }), e.register("msg-actions", (r, i) => {
10079
10160
  var a = r.attrs || {}, o = a.clk || "", s = "tokui-msg-actions";
10080
10161
  a.visible && (s += " tokui-msg-actions--visible");
10081
- var c = t("div", { class: s }), l = {
10162
+ var c = { class: s };
10163
+ a.id && (c.id = a.id);
10164
+ var l = t("div", c), u = {
10082
10165
  copy: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"8\" y=\"8\" width=\"13\" height=\"13\" rx=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg>",
10083
10166
  regenerate: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/><path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\"/><path d=\"M3 21v-5h5\"/></svg>",
10084
10167
  like: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M7 10v12\"/><path d=\"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\"/></svg>",
10085
10168
  dislike: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M17 14V2\"/><path d=\"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\"/></svg>",
10086
10169
  delete: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/></svg>"
10087
- }, u = [];
10088
- a.copy !== void 0 && u.push({
10170
+ }, d = [];
10171
+ a.copy !== void 0 && d.push({
10089
10172
  act: "copy",
10090
- icon: l.copy,
10173
+ icon: u.copy,
10091
10174
  label: n("actions.copy")
10092
- }), a.regenerate !== void 0 && u.push({
10175
+ }), a.regenerate !== void 0 && d.push({
10093
10176
  act: "regenerate",
10094
- icon: l.regenerate,
10177
+ icon: u.regenerate,
10095
10178
  label: n("actions.regenerate")
10096
- }), a.like !== void 0 && (u.push({
10179
+ }), a.like !== void 0 && (d.push({
10097
10180
  act: "like",
10098
- icon: l.like,
10181
+ icon: u.like,
10099
10182
  label: n("actions.like")
10100
- }), u.push({
10183
+ }), d.push({
10101
10184
  act: "dislike",
10102
- icon: l.dislike,
10185
+ icon: u.dislike,
10103
10186
  label: n("actions.dislike")
10104
- })), a.delete !== void 0 && u.push({
10187
+ })), a.delete !== void 0 && d.push({
10105
10188
  act: "delete",
10106
- icon: l.delete,
10189
+ icon: u.delete,
10107
10190
  label: n("actions.delete")
10108
- }), u.forEach(function(e) {
10191
+ }), d.forEach(function(e) {
10109
10192
  var n = t("button", {
10110
10193
  class: "tokui-msg-actions__btn",
10111
10194
  type: "button",
@@ -10113,102 +10196,128 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10113
10196
  "aria-label": e.label,
10114
10197
  title: e.label
10115
10198
  }), r = t("span", { class: "tokui-msg-actions__icon" });
10116
- r.innerHTML = e.icon, n.appendChild(r), c.appendChild(n);
10199
+ r.innerHTML = e.icon, n.appendChild(r), l.appendChild(n);
10117
10200
  }), r.children && r.children.length > 0 && i(r.children).forEach(function(e) {
10118
- e && e.nodeType && c.appendChild(e);
10201
+ e && e.nodeType && l.appendChild(e);
10119
10202
  });
10120
- var d = e.createReporter("msg-actions", a, c);
10121
- return o && c.setAttribute("data-tokui-clk", o), c.addEventListener("click", function(e) {
10203
+ var f = e.createReporter("msg-actions", a, l);
10204
+ return o && l.setAttribute("data-tokui-clk", o), l.addEventListener("click", function(e) {
10122
10205
  var t = e.target.closest && e.target.closest(".tokui-msg-actions__btn");
10123
10206
  if (t) {
10124
10207
  var n = t.getAttribute("data-act");
10125
- n && (c.setAttribute("data-tokui-clk-act", n), d("action", { act: n }));
10208
+ n && (l.setAttribute("data-tokui-clk-act", n), f("action", { act: n }));
10126
10209
  }
10127
- }), c._slot = c, c._tokuiType = "msg-actions", c;
10210
+ }), l._slot = l, l._tokuiType = "msg-actions", l;
10128
10211
  }), e.register("tool-call", (r, i) => {
10129
- var a = r.attrs || {}, o = a.name || "tool", s = a.status || "pending", c = a.duration || "", l = { class: "tokui-tool-call tokui-tool-call--" + s };
10130
- a.id && (l.id = a.id);
10131
- var u = t("div", l), d = t("div", { class: "tokui-tool-call__header" }), f = t("span", { class: "tokui-tool-call__status-dot tokui-tool-call__status-dot--" + s });
10132
- d.appendChild(f);
10133
- var p = t("span", { class: "tokui-tool-call__name" });
10134
- p.textContent = o, d.appendChild(p);
10135
- var m = t("span", { class: "tokui-tool-call__status" }), h = {
10136
- pending: n("status.pending"),
10137
- running: n("status.running"),
10138
- done: n("status.done"),
10139
- error: n("status.error"),
10140
- denied: n("status.denied")
10141
- };
10142
- if (m.textContent = h[s] || s, d.appendChild(m), c) {
10143
- var g = t("span", { class: "tokui-tool-call__duration" });
10144
- g.textContent = c, d.appendChild(g);
10212
+ var a = r.attrs || {}, o = a.name || n("toolCall.defaultName"), s = a.status || "pending", c = a.duration || "", l = a.collapsed !== void 0, u = { class: "tokui-tool-call tokui-tool-call--" + s + (l ? " tokui-tool-call--collapsed" : "") };
10213
+ a.id && (u.id = a.id);
10214
+ var d = t("div", u), f = t("div", {
10215
+ class: "tokui-tool-call__header",
10216
+ role: "button",
10217
+ tabindex: "0",
10218
+ "aria-expanded": String(!l)
10219
+ }), p = t("span", { class: "tokui-tool-call__status-dot tokui-tool-call__status-dot--" + s });
10220
+ f.appendChild(p);
10221
+ var m = t("span", { class: "tokui-tool-call__name" });
10222
+ m.textContent = o, f.appendChild(m);
10223
+ var h = t("span", { class: "tokui-tool-call__status" });
10224
+ function g(e) {
10225
+ return {
10226
+ pending: n("status.pending"),
10227
+ running: n("status.running"),
10228
+ done: n("status.done"),
10229
+ error: n("status.error"),
10230
+ denied: n("status.denied")
10231
+ }[e] || e;
10232
+ }
10233
+ if (h.textContent = g(s), f.appendChild(h), c) {
10234
+ var _ = t("span", { class: "tokui-tool-call__duration" });
10235
+ _.textContent = c, f.appendChild(_);
10236
+ }
10237
+ var v = t("span", {
10238
+ class: "tokui-tool-call__chevron",
10239
+ "aria-hidden": "true"
10240
+ });
10241
+ v.textContent = "▾", f.appendChild(v), d.appendChild(f);
10242
+ var y = t("div", { class: "tokui-tool-call__body" });
10243
+ function b() {
10244
+ var e = d.classList.toggle("tokui-tool-call--collapsed");
10245
+ f.setAttribute("aria-expanded", String(!e));
10145
10246
  }
10146
- u.appendChild(d);
10147
- var _ = t("div", { class: "tokui-tool-call__body" });
10148
- if (r.content) {
10149
- var v = t("div", { class: "tokui-tool-call__params" });
10150
- v.textContent = r.content, _.appendChild(v);
10247
+ if (f.addEventListener("click", b), f.addEventListener("keydown", function(e) {
10248
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
10249
+ }), r.content) {
10250
+ var x = t("div", { class: "tokui-tool-call__params" });
10251
+ x.textContent = r.content, y.appendChild(x);
10151
10252
  }
10152
10253
  if (i(r.children || []).forEach(function(e) {
10153
- e && e.nodeType && _.appendChild(e);
10154
- }), u.appendChild(_), a.approval !== void 0 && s === "pending") {
10155
- var y = e.createReporter("tool-call", a, u), b = a.clk || "", x = t("div", { class: "tokui-tool-call__approval" }), S = t("button", {
10254
+ e && e.nodeType && y.appendChild(e);
10255
+ }), d.appendChild(y), a.approval !== void 0 && s === "pending") {
10256
+ var S = e.createReporter("tool-call", a, d), C = a.clk || "", w = t("div", { class: "tokui-tool-call__approval" }), T = t("button", {
10156
10257
  class: "tokui-tool-call__approve",
10157
10258
  type: "button"
10158
- }, n("actions.approve")), C = t("button", {
10259
+ }, n("actions.approve")), E = t("button", {
10159
10260
  class: "tokui-tool-call__deny",
10160
10261
  type: "button"
10161
- }, n("actions.deny")), w = function(t) {
10162
- S.setAttribute("disabled", ""), C.setAttribute("disabled", ""), (t ? S : C).classList.add("tokui-tool-call__approval--chosen"), x.classList.add("tokui-tool-call__approval--decided");
10262
+ }, n("actions.deny")), D = function(t) {
10263
+ T.setAttribute("disabled", ""), E.setAttribute("disabled", ""), (t ? T : E).classList.add("tokui-tool-call__approval--chosen"), w.classList.add("tokui-tool-call__approval--decided");
10163
10264
  var n = {
10164
10265
  approved: t,
10165
10266
  id: a.id || null,
10166
10267
  name: o
10167
10268
  };
10168
- if (b && e.eventBus) {
10169
- var r = e.eventBus.getHandler(b);
10170
- r && r(n, null, u);
10269
+ if (C && e.eventBus) {
10270
+ var r = e.eventBus.getHandler(C);
10271
+ r && r(n, null, d);
10171
10272
  }
10172
- y("approval", n);
10273
+ S("approval", n);
10173
10274
  };
10174
- S.addEventListener("click", function() {
10175
- w(!0);
10176
- }), C.addEventListener("click", function() {
10177
- w(!1);
10178
- }), x.appendChild(S), x.appendChild(C), u.appendChild(x);
10275
+ T.addEventListener("click", function() {
10276
+ D(!0);
10277
+ }), E.addEventListener("click", function() {
10278
+ D(!1);
10279
+ }), w.appendChild(T), w.appendChild(E), d.appendChild(w);
10179
10280
  }
10180
- return u._slot = _, u._tokuiType = "tool-call", u._update = function(e) {
10181
- if (e.status && (u.className = "tokui-tool-call tokui-tool-call--" + e.status, f.className = "tokui-tool-call__status-dot tokui-tool-call__status-dot--" + e.status, m.textContent = h[e.status] || e.status), e.duration) {
10182
- var n = u.querySelector(".tokui-tool-call__duration");
10183
- n || (n = t("span", { class: "tokui-tool-call__duration" }), d.appendChild(n)), n.textContent = e.duration;
10281
+ return d._slot = y, d._tokuiType = "tool-call", d._update = function(e) {
10282
+ if (e.status) {
10283
+ var n = d.classList.contains("tokui-tool-call--collapsed");
10284
+ d.className = "tokui-tool-call tokui-tool-call--" + e.status + (n ? " tokui-tool-call--collapsed" : ""), p.className = "tokui-tool-call__status-dot tokui-tool-call__status-dot--" + e.status, h.textContent = g(e.status);
10285
+ }
10286
+ if (e.duration) {
10287
+ var r = d.querySelector(".tokui-tool-call__duration");
10288
+ r || (r = t("span", { class: "tokui-tool-call__duration" }), f.appendChild(r)), r.textContent = e.duration;
10184
10289
  }
10185
10290
  if (e.result) {
10186
- var r = t("div", { class: "tokui-tool-call__result" });
10187
- r.textContent = e.result, _.appendChild(r);
10291
+ var i = y.querySelector(".tokui-tool-call__result");
10292
+ i || (i = t("div", { class: "tokui-tool-call__result" }), y.appendChild(i)), i.textContent = e.result;
10188
10293
  }
10189
10294
  if (e.error) {
10190
- var i = t("div", { class: "tokui-tool-call__error" });
10191
- i.textContent = e.error, _.appendChild(i);
10295
+ var a = y.querySelector(".tokui-tool-call__error");
10296
+ a || (a = t("div", { class: "tokui-tool-call__error" }), y.appendChild(a)), a.textContent = e.error;
10192
10297
  }
10193
- }, u;
10298
+ }, d;
10194
10299
  }), e.register("typing", (e) => {
10195
- for (var n = e.attrs || {}, r = t("div", { class: "tokui-typing" }), i = t("span", { class: "tokui-typing__dots" }), a = 0; a < 3; a++) {
10196
- var o = t("span", { class: "tokui-typing__dot" });
10197
- o.style.animationDelay = a * .15 + "s", i.appendChild(o);
10300
+ var n = e.attrs || {}, r = { class: "tokui-typing" };
10301
+ n.id && (r.id = n.id);
10302
+ for (var i = t("div", r), a = t("span", { class: "tokui-typing__dots" }), o = 0; o < 3; o++) {
10303
+ var s = t("span", { class: "tokui-typing__dot" });
10304
+ s.style.animationDelay = o * .15 + "s", a.appendChild(s);
10198
10305
  }
10199
- if (r.appendChild(i), n.text) {
10200
- var s = t("span", { class: "tokui-typing__text" });
10201
- s.textContent = n.text, r.appendChild(s);
10306
+ if (i.appendChild(a), n.text) {
10307
+ var c = t("span", { class: "tokui-typing__text" });
10308
+ c.textContent = n.text, i.appendChild(c);
10202
10309
  }
10203
- return r;
10310
+ return i._tokuiType = "typing", i;
10204
10311
  }), e.register("quick-reply", (n, r) => {
10205
- var i = n.attrs || {}, a = i.clk || "", o = t("div", { class: "tokui-quick-reply" }), s = t("div", { class: "tokui-quick-reply__items" }), c = e.createReporter("quick-reply", i, o);
10206
- function l(t) {
10312
+ var i = n.attrs || {}, a = i.clk || "", o = { class: "tokui-quick-reply" };
10313
+ i.id && (o.id = i.id);
10314
+ var s = t("div", o), c = t("div", { class: "tokui-quick-reply__items" }), l = e.createReporter("quick-reply", i, s);
10315
+ function u(t) {
10207
10316
  if (a && e.eventBus) {
10208
10317
  var n = e.eventBus.getHandler(a);
10209
- n ? n({ value: t }, null, o) : e._warnMissingHandler(a);
10318
+ n ? n({ value: t }, null, s) : e._warnMissingHandler(a);
10210
10319
  }
10211
- c("select", { value: t });
10320
+ l("select", { value: t });
10212
10321
  }
10213
10322
  return i.items && i.items.split(",").forEach(function(e) {
10214
10323
  var n = e.trim(), r = t("button", {
@@ -10216,16 +10325,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10216
10325
  type: "button"
10217
10326
  });
10218
10327
  r.textContent = n, r.addEventListener("click", function() {
10219
- l(n);
10220
- }), s.appendChild(r);
10328
+ u(n);
10329
+ }), c.appendChild(r);
10221
10330
  }), n.children && n.children.length && r(n.children).forEach(function(e) {
10222
- e && e.nodeType && s.appendChild(e);
10223
- }), o.appendChild(s), o._slot = s, o._tokuiType = "quick-reply", o;
10331
+ e && e.nodeType && c.appendChild(e);
10332
+ }), s.appendChild(c), s._slot = c, s._tokuiType = "quick-reply", s;
10224
10333
  }), e.register("suggestions", (e, n) => {
10225
10334
  var r = e.attrs || {}, i = Math.min(4, Math.max(1, parseInt(r.cols) || 2)), a = t("div", { class: "tokui-suggestions" });
10226
10335
  r.clk && a.setAttribute("data-tokui-clk", r.clk), r.id && (a.id = r.id);
10227
10336
  var o = t("div", { class: "tokui-suggestions__grid tokui-suggestions__grid--" + i });
10228
- return o.style.gridTemplateColumns = "repeat(" + i + ", 1fr)", e.children && e.children.length && n(e.children).forEach(function(e) {
10337
+ return e.children && e.children.length && n(e.children).forEach(function(e) {
10229
10338
  e && e.nodeType && o.appendChild(e);
10230
10339
  }), a.appendChild(o), a._slot = o, a._tokuiType = "suggestions", a;
10231
10340
  }), e.register("suggestion", (n) => {
@@ -10254,48 +10363,53 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10254
10363
  return s.appendChild(d), s.addEventListener("keydown", function(e) {
10255
10364
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), s.click());
10256
10365
  }), s;
10257
- }), e.register("source", (e) => {
10258
- var n = e.attrs || {}, r = n.n || "1", i = n.tt || "", a = n.sn || "", o = n.u || n.url || "", s = t("div", { class: "tokui-source" }), c = t("span", { class: "tokui-source__num" });
10259
- c.textContent = r, s.appendChild(c);
10260
- var l = t("div", { class: "tokui-source__body" });
10261
- if (i) {
10262
- var u = o ? t("a", {
10366
+ }), e.register("source", (n) => {
10367
+ var r = n.attrs || {}, i = r.n || "1", a = r.tt || "", o = r.sn || "", s = r.u || r.url || "", c = t("div", { class: "tokui-source" }), l = t("span", { class: "tokui-source__num" });
10368
+ l.textContent = i, c.appendChild(l);
10369
+ var u = t("div", { class: "tokui-source__body" }), d = e.createReporter("source", r, c);
10370
+ if (a) {
10371
+ var f;
10372
+ s ? (f = t("a", {
10263
10373
  class: "tokui-source__title",
10264
- href: o,
10374
+ href: s,
10265
10375
  target: "_blank"
10266
- }) : t("span", { class: "tokui-source__title" });
10267
- u.textContent = i, l.appendChild(u);
10376
+ }), f.addEventListener("click", function() {
10377
+ d("open", {
10378
+ url: s,
10379
+ title: a
10380
+ });
10381
+ })) : f = t("span", { class: "tokui-source__title" }), f.textContent = a, u.appendChild(f);
10268
10382
  }
10269
- if (a) {
10270
- var d = t("div", { class: "tokui-source__snippet" });
10271
- d.textContent = a, l.appendChild(d);
10383
+ if (o) {
10384
+ var p = t("div", { class: "tokui-source__snippet" });
10385
+ p.textContent = o, u.appendChild(p);
10272
10386
  }
10273
- return s.appendChild(l), s;
10387
+ return c.appendChild(u), c;
10274
10388
  });
10275
- function E(e, n) {
10389
+ function D(e, n) {
10276
10390
  var r = t("div", { class: "tokui-diff__line" }), i = t("span", { class: "tokui-diff__num" }), a = t("span", { class: "tokui-diff__code" });
10277
10391
  return e.startsWith("+") ? (r.classList.add("tokui-diff__line--add"), n.newLine++, i.textContent = n.newLine, a.textContent = e) : e.startsWith("-") ? (r.classList.add("tokui-diff__line--remove"), n.oldLine++, i.textContent = n.oldLine, a.textContent = e) : (r.classList.add("tokui-diff__line--context"), n.oldLine++, n.newLine++, i.textContent = n.oldLine, a.textContent = e || " "), r.appendChild(i), r.appendChild(a), r;
10278
10392
  }
10279
- function D(e, t) {
10393
+ function O(e, t) {
10280
10394
  e.innerHTML = "";
10281
10395
  for (var n = t.split("\n"), r = n.length - 1, i = {
10282
10396
  oldLine: 0,
10283
10397
  newLine: 0
10284
- }, a = 0; a < r; a++) e.appendChild(E(n[a], i));
10285
- var o = E(n[r], {
10398
+ }, a = 0; a < r; a++) e.appendChild(D(n[a], i));
10399
+ var o = D(n[r], {
10286
10400
  oldLine: i.oldLine,
10287
10401
  newLine: i.newLine
10288
10402
  });
10289
10403
  e.appendChild(o), e._diffFrozenCount = r, e._diffState = i, e._diffGrowingEl = o;
10290
10404
  }
10291
- function O(e, t) {
10405
+ function k(e, t) {
10292
10406
  if (typeof e._diffFrozenCount != "number" || !e._diffState) {
10293
- D(e, t);
10407
+ O(e, t);
10294
10408
  return;
10295
10409
  }
10296
- for (var n = t.split("\n"), r = n.length - 1, i = e._diffState, a = e._diffGrowingEl, o = e._diffFrozenCount; o < r; o++) e.insertBefore(E(n[o], i), a || null);
10410
+ for (var n = t.split("\n"), r = n.length - 1, i = e._diffState, a = e._diffGrowingEl, o = e._diffFrozenCount; o < r; o++) e.insertBefore(D(n[o], i), a || null);
10297
10411
  e._diffFrozenCount = r;
10298
- var s = E(n[r], {
10412
+ var s = D(n[r], {
10299
10413
  oldLine: i.oldLine,
10300
10414
  newLine: i.newLine
10301
10415
  });
@@ -10307,29 +10421,31 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10307
10421
  }
10308
10422
  }
10309
10423
  e.register("diff", (e, n) => {
10310
- var r = e.attrs || {}, i = t("div", { class: "tokui-diff" });
10424
+ var r = e.attrs || {}, i = { class: "tokui-diff" };
10425
+ r.id && (i.id = r.id);
10426
+ var a = t("div", i);
10311
10427
  if (r.title || r.lang) {
10312
- var a = t("div", { class: "tokui-diff__header" });
10428
+ var o = t("div", { class: "tokui-diff__header" });
10313
10429
  if (r.title) {
10314
- var o = t("span", { class: "tokui-diff__title" });
10315
- o.textContent = r.title, a.appendChild(o);
10430
+ var s = t("span", { class: "tokui-diff__title" });
10431
+ s.textContent = r.title, o.appendChild(s);
10316
10432
  }
10317
10433
  if (r.lang) {
10318
- var s = t("span", { class: "tokui-diff__lang" });
10319
- s.textContent = r.lang, a.appendChild(s);
10434
+ var c = t("span", { class: "tokui-diff__lang" });
10435
+ c.textContent = r.lang, o.appendChild(c);
10320
10436
  }
10321
- i.appendChild(a);
10437
+ a.appendChild(o);
10322
10438
  }
10323
- var c = t("div", { class: "tokui-diff__content" }), l = "";
10324
- l = e.children && e.children.length > 0 ? e.children.map(function(e) {
10439
+ var l = t("div", { class: "tokui-diff__content" }), u = "";
10440
+ u = e.children && e.children.length > 0 ? e.children.map(function(e) {
10325
10441
  return e.content || "";
10326
10442
  }).join("") : e.content || "";
10327
- function u() {
10328
- D(c, l);
10443
+ function d() {
10444
+ O(l, u);
10329
10445
  }
10330
- return u(), i.appendChild(c), i._slot = c, i._tokuiType = "diff", i._streamAppendHook = function(e) {
10331
- e && e.type === "_text" && e.content && (l += e.content, O(c, l));
10332
- }, i._streamCloseHook = u, i;
10446
+ return d(), a.appendChild(l), a._slot = l, a._tokuiType = "diff", a._streamAppendHook = function(e) {
10447
+ e && e.type === "_text" && e.content && (u += e.content, k(l, u));
10448
+ }, a._streamCloseHook = d, a;
10333
10449
  }), e.register("plan", (e, n) => {
10334
10450
  var r = e.attrs || {}, i = t("div", { class: "tokui-plan" });
10335
10451
  if (r.tt) {
@@ -10340,14 +10456,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10340
10456
  return n(e.children || []).forEach(function(e) {
10341
10457
  e && e.nodeType && o.appendChild(e);
10342
10458
  }), i.appendChild(o), i._slot = o, i._tokuiType = "plan", i;
10343
- }), e.register("plan-step", (e, n) => {
10344
- var r = e.attrs || {}, i = {
10459
+ }), e.register("plan-step", (e) => {
10460
+ var n = e.attrs || {}, r = {
10345
10461
  pending: 1,
10346
10462
  doing: 1,
10347
10463
  done: 1,
10348
10464
  error: 1,
10349
10465
  skipped: 1
10350
- }, a = {
10466
+ }, i = {
10351
10467
  running: "doing",
10352
10468
  active: "doing",
10353
10469
  progress: "doing",
@@ -10368,41 +10484,46 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10368
10484
  fail: "error",
10369
10485
  failed: "error",
10370
10486
  failure: "error"
10371
- }, o = String(r.status || "pending").toLowerCase(), s = t("div", { class: "tokui-plan-step tokui-plan-step--" + (a[o] || (i[o] ? o : "pending")) }), c = t("span", { class: "tokui-plan-step__dot" });
10372
- s.appendChild(c);
10373
- var l = t("div", { class: "tokui-plan-step__content" });
10374
- if (r.tt) {
10375
- var u = t("div", { class: "tokui-plan-step__title" });
10376
- u.textContent = r.tt, l.appendChild(u);
10377
- }
10378
- if (r.desc) {
10379
- var d = t("div", { class: "tokui-plan-step__desc" });
10380
- d.textContent = r.desc, l.appendChild(d);
10487
+ };
10488
+ function a(e) {
10489
+ var t = String(e || "pending").toLowerCase();
10490
+ return i[t] || (r[t] ? t : "pending");
10381
10491
  }
10382
- if (e.content) {
10492
+ var o = { class: "tokui-plan-step tokui-plan-step--" + a(n.status) };
10493
+ n.id && (o.id = n.id);
10494
+ var s = t("div", o), c = t("span", { class: "tokui-plan-step__dot" });
10495
+ s.appendChild(c);
10496
+ var l = t("div", { class: "tokui-plan-step__content" }), u = null;
10497
+ n.tt && (u = t("div", { class: "tokui-plan-step__title" }), u.textContent = n.tt, l.appendChild(u));
10498
+ var d = null;
10499
+ if (n.desc && (d = t("div", { class: "tokui-plan-step__desc" }), d.textContent = n.desc, l.appendChild(d)), e.content) {
10383
10500
  var f = t("div", { class: "tokui-plan-step__text" });
10384
10501
  f.textContent = e.content, l.appendChild(f);
10385
10502
  }
10386
- n(e.children || []).forEach(function(e) {
10387
- e && e.nodeType && l.appendChild(e);
10388
- }), s.appendChild(l);
10503
+ s.appendChild(l);
10389
10504
  var p = t("div", { class: "tokui-plan-step__line" });
10390
- return s.appendChild(p), s;
10505
+ return s.appendChild(p), s._update = function(e) {
10506
+ e.status && (s.className = "tokui-plan-step tokui-plan-step--" + a(e.status)), e.tt !== void 0 && (u || (u = t("div", { class: "tokui-plan-step__title" }), l.insertBefore(u, l.childNodes[0] || null)), u.textContent = e.tt), e.desc !== void 0 && (d || (d = t("div", { class: "tokui-plan-step__desc" }), l.appendChild(d)), d.textContent = e.desc);
10507
+ }, s;
10391
10508
  }), e.register("agent", (e, r) => {
10392
- var i = e.attrs || {}, a = i.name || "Agent", o = i.status || "idle", s = i.action || "", c = i.duration || "", l = { class: "tokui-agent tokui-agent--" + o };
10509
+ var i = e.attrs || {}, a = i.name || n("agent.defaultName"), o = i.status || "idle", s = i.action || "", c = i.duration || "", l = { class: "tokui-agent tokui-agent--" + o };
10393
10510
  i.id && (l.id = i.id);
10394
10511
  var u = t("div", l), d = t("div", { class: "tokui-agent__header" }), f = t("span", { class: "tokui-agent__status-dot tokui-agent__status-dot--" + o });
10395
10512
  d.appendChild(f);
10396
10513
  var p = t("span", { class: "tokui-agent__name" });
10397
10514
  p.textContent = a, d.appendChild(p);
10398
- var m = t("span", { class: "tokui-agent__status" }), h = {
10399
- idle: n("status.idle"),
10400
- running: n("status.running"),
10401
- paused: n("status.paused"),
10402
- done: n("status.done"),
10403
- error: n("status.error")
10404
- };
10405
- if (m.textContent = h[o] || o, d.appendChild(m), c) {
10515
+ var m = t("span", { class: "tokui-agent__status" });
10516
+ function h(e) {
10517
+ var t = {
10518
+ idle: "status.idle",
10519
+ running: "status.running",
10520
+ paused: "status.paused",
10521
+ done: "status.done",
10522
+ error: "status.error"
10523
+ };
10524
+ return t[e] ? n(t[e]) : e;
10525
+ }
10526
+ if (m.textContent = h(o), d.appendChild(m), c) {
10406
10527
  var g = t("span", { class: "tokui-agent__duration" });
10407
10528
  g.textContent = c, d.appendChild(g);
10408
10529
  }
@@ -10410,14 +10531,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10410
10531
  var _ = t("div", { class: "tokui-agent__action" });
10411
10532
  _.textContent = s, u.appendChild(_);
10412
10533
  }
10413
- if (e.children && e.children.length) {
10414
- var v = t("div", { class: "tokui-agent__body" });
10415
- r(e.children).forEach(function(e) {
10416
- e && e.nodeType && v.appendChild(e);
10417
- }), u.appendChild(v), u._slot = v;
10418
- }
10419
- return u._tokuiType = "agent", u._update = function(e) {
10420
- e.status && (u.className = "tokui-agent tokui-agent--" + e.status, f.className = "tokui-agent__status-dot tokui-agent__status-dot--" + e.status, m.textContent = h[e.status] || e.status), e.action && _ && (_.textContent = e.action), e.duration && g && (g.textContent = e.duration);
10534
+ var v = t("div", { class: "tokui-agent__body" });
10535
+ return r(e.children || []).forEach(function(e) {
10536
+ e && e.nodeType && v.appendChild(e);
10537
+ }), u.appendChild(v), u._slot = v, u._tokuiType = "agent", u._update = function(e) {
10538
+ e.status && (u.className = "tokui-agent tokui-agent--" + e.status, f.className = "tokui-agent__status-dot tokui-agent__status-dot--" + e.status, m.textContent = h(e.status)), e.action && _ && (_.textContent = e.action), e.duration && g && (g.textContent = e.duration);
10421
10539
  }, u;
10422
10540
  }), e.register("file-tree", (e, n) => {
10423
10541
  var r = t("div", {
@@ -10427,32 +10545,36 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10427
10545
  return n(e.children || []).forEach(function(e) {
10428
10546
  e && e.nodeType && r.appendChild(e);
10429
10547
  }), r._slot = r, r._tokuiType = "file-tree", r;
10430
- }), e.register("ft-folder", (e, n) => {
10431
- var r = e.attrs || {}, i = r.name || "folder", a = r.open !== void 0, o = t("div", { class: "tokui-file-tree__folder" + (a ? " tokui-file-tree__folder--open" : "") }), s = t("div", {
10548
+ }), e.register("ft-folder", (n, r) => {
10549
+ var i = n.attrs || {}, a = i.name || "folder", o = i.open !== void 0, s = t("div", { class: "tokui-file-tree__folder" + (o ? " tokui-file-tree__folder--open" : "") }), c = t("div", {
10432
10550
  class: "tokui-file-tree__folder-name",
10433
10551
  role: "treeitem",
10434
10552
  tabindex: "0",
10435
- "aria-expanded": String(a)
10436
- }), c = t("span", { class: "tokui-file-tree__folder-toggle" });
10437
- c.textContent = a ? "▾" : "▸", s.appendChild(c);
10438
- var l = t("span", { class: "tokui-file-tree__folder-icon" });
10439
- l.textContent = "📁", s.appendChild(l);
10440
- var u = t("span", { class: "tokui-file-tree__name" });
10441
- u.textContent = i, s.appendChild(u), o.appendChild(s);
10442
- var d = t("div", {
10553
+ "aria-expanded": String(o)
10554
+ }), l = t("span", { class: "tokui-file-tree__folder-toggle" });
10555
+ l.textContent = o ? "▾" : "▸", c.appendChild(l);
10556
+ var u = t("span", { class: "tokui-file-tree__folder-icon" });
10557
+ u.textContent = "📁", c.appendChild(u);
10558
+ var d = t("span", { class: "tokui-file-tree__name" });
10559
+ d.textContent = a, c.appendChild(d), s.appendChild(c);
10560
+ var f = t("div", {
10443
10561
  class: "tokui-file-tree__folder-children",
10444
10562
  role: "group"
10445
10563
  });
10446
- a || (d.style.display = "none"), n(e.children || []).forEach(function(e) {
10447
- e && e.nodeType && d.appendChild(e);
10448
- }), o.appendChild(d);
10449
- function f() {
10450
- var e = o.classList.toggle("tokui-file-tree__folder--open");
10451
- c.textContent = e ? "▾" : "▸", d.style.display = e ? "" : "none", s.setAttribute("aria-expanded", String(e));
10564
+ o || (f.style.display = "none"), r(n.children || []).forEach(function(e) {
10565
+ e && e.nodeType && f.appendChild(e);
10566
+ }), s.appendChild(f);
10567
+ var p = e.createReporter("ft-folder", i, s);
10568
+ function m() {
10569
+ var e = s.classList.toggle("tokui-file-tree__folder--open");
10570
+ l.textContent = e ? "▾" : "▸", f.style.display = e ? "" : "none", c.setAttribute("aria-expanded", String(e)), p("toggle", {
10571
+ name: a,
10572
+ open: e
10573
+ });
10452
10574
  }
10453
- return s.addEventListener("click", f), s.addEventListener("keydown", function(e) {
10454
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), f());
10455
- }), o._slot = d, o._tokuiType = "ft-folder", o;
10575
+ return c.addEventListener("click", m), c.addEventListener("keydown", function(e) {
10576
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), m());
10577
+ }), s._slot = f, s._tokuiType = "ft-folder", s;
10456
10578
  }), e.register("ft-file", (e) => {
10457
10579
  var n = e.attrs || {}, r = n.name || "file", i = n.badge || "", a = t("div", {
10458
10580
  class: "tokui-file-tree__file",
@@ -10465,32 +10587,34 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10465
10587
  c.textContent = i, a.appendChild(c);
10466
10588
  }
10467
10589
  return a;
10468
- }), e.register("terminal", (e, r) => {
10469
- var i = e.attrs || {}, a = i.title || "Terminal", o = i.status || "", s = t("div", { class: "tokui-terminal" + (o && o !== "0" ? " tokui-terminal--error" : "") }), c = t("div", { class: "tokui-terminal__titlebar" }), l = t("span", { class: "tokui-terminal__dots" });
10590
+ }), e.register("terminal", (r, i) => {
10591
+ var a = r.attrs || {}, o = a.title || n("terminal.title"), s = a.status || "", c = { class: "tokui-terminal" + (s && s !== "0" ? " tokui-terminal--error" : "") };
10592
+ a.id && (c.id = a.id);
10593
+ var l = t("div", c), u = t("div", { class: "tokui-terminal__titlebar" }), d = t("span", { class: "tokui-terminal__dots" });
10470
10594
  [
10471
10595
  "🔴",
10472
10596
  "🟡",
10473
10597
  "🟢"
10474
10598
  ].forEach(function(e) {
10475
10599
  var n = t("span", { class: "tokui-terminal__dot" });
10476
- n.textContent = e, l.appendChild(n);
10477
- }), c.appendChild(l);
10478
- var u = t("span", { class: "tokui-terminal__title" });
10479
- u.textContent = a, c.appendChild(u), s.appendChild(c);
10480
- var d = t("div", { class: "tokui-terminal__content" });
10481
- e.content && (d.textContent = e.content), r(e.children || []).forEach(function(e) {
10482
- e && e.nodeType && d.appendChild(e);
10483
- }), s.appendChild(d);
10484
- var f = t("button", {
10600
+ n.textContent = e, d.appendChild(n);
10601
+ }), u.appendChild(d);
10602
+ var f = t("span", { class: "tokui-terminal__title" });
10603
+ f.textContent = o, u.appendChild(f), l.appendChild(u);
10604
+ var p = t("div", { class: "tokui-terminal__content" });
10605
+ r.content && (p.textContent = r.content), i(r.children || []).forEach(function(e) {
10606
+ e && e.nodeType && p.appendChild(e);
10607
+ }), l.appendChild(p);
10608
+ var m = e.createReporter("terminal", a, l), h = t("button", {
10485
10609
  class: "tokui-terminal__copy",
10486
10610
  type: "button"
10487
10611
  });
10488
- return f.textContent = n("actions.copy"), f.addEventListener("click", function() {
10489
- var e = d.textContent || "";
10490
- typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(e), f.textContent = n("common.copied"), f.classList.add("tokui-terminal__copy--done"), setTimeout(function() {
10491
- f.textContent = n("actions.copy"), f.classList.remove("tokui-terminal__copy--done");
10612
+ return h.textContent = n("actions.copy"), h.addEventListener("click", function() {
10613
+ var e = p.textContent || "";
10614
+ typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(e), h.textContent = n("common.copied"), h.classList.add("tokui-terminal__copy--done"), m("copy", {}), setTimeout(function() {
10615
+ h.textContent = n("actions.copy"), h.classList.remove("tokui-terminal__copy--done");
10492
10616
  }, 2e3);
10493
- }), c.appendChild(f), s._slot = d, s._tokuiType = "terminal", s;
10617
+ }), u.appendChild(h), l._slot = p, l._tokuiType = "terminal", l;
10494
10618
  }), e.register("shimmer", (e) => {
10495
10619
  var n = e.attrs || {}, r = n.t || "text", i = parseInt(n.rows) || 3, a = t("div", { class: "tokui-shimmer tokui-shimmer--" + r });
10496
10620
  if (r === "card") {
@@ -10554,57 +10678,59 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10554
10678
  preload: "metadata"
10555
10679
  });
10556
10680
  return r && d.setAttribute("src", r), d.setAttribute("controls", ""), o.appendChild(d), o;
10557
- }), e.register("quote", (e, n) => {
10558
- var r = e.attrs || {}, i = t("div", { class: "tokui-quote" }), a = t("div", { class: "tokui-quote__bar" });
10559
- i.appendChild(a);
10560
- var o = t("div", { class: "tokui-quote__content" });
10561
- if (r.role) {
10562
- var s = t("span", { class: "tokui-quote__role" });
10563
- s.textContent = r.role === "user" ? "User" : "AI", o.appendChild(s);
10564
- }
10565
- if (r.tx) {
10566
- var c = t("div", { class: "tokui-quote__text" });
10567
- c.textContent = r.tx, o.appendChild(c);
10568
- }
10569
- return r.msgid && i.setAttribute("data-msgid", r.msgid), n(e.children || []).forEach(function(e) {
10570
- e && e.nodeType && o.appendChild(e);
10571
- }), i.appendChild(o), i._slot = o, i._tokuiType = "quote", i;
10572
- }), e.register("sandbox", (e, n) => {
10573
- var r = e.attrs || {}, i = r.lang || "", a = r.title || "Preview", o = r.height || "200", s = t("div", { class: "tokui-sandbox" }), c = t("div", { class: "tokui-sandbox__header" }), l = t("span", { class: "tokui-sandbox__title" });
10574
- if (l.textContent = a, c.appendChild(l), i) {
10575
- var u = t("span", { class: "tokui-sandbox__lang" });
10576
- u.textContent = i, c.appendChild(u);
10681
+ }), e.register("quote", (e, r) => {
10682
+ var i = e.attrs || {}, a = t("div", { class: "tokui-quote" }), o = t("div", { class: "tokui-quote__bar" });
10683
+ a.appendChild(o);
10684
+ var s = t("div", { class: "tokui-quote__content" });
10685
+ if (i.role) {
10686
+ var c = t("span", { class: "tokui-quote__role" });
10687
+ c.textContent = i.role === "user" ? n("bubble.you") : n("bubble.ai"), s.appendChild(c);
10577
10688
  }
10578
- s.appendChild(c);
10579
- var d = t("div", { class: "tokui-sandbox__preview" });
10580
- d.style.height = o + "px";
10581
- var f = e.content || "";
10582
- if (!f && e.children && (f = e.children.filter(function(e) {
10689
+ if (i.tx) {
10690
+ var l = t("div", { class: "tokui-quote__text" });
10691
+ l.textContent = i.tx, s.appendChild(l);
10692
+ }
10693
+ return i.msgid && a.setAttribute("data-msgid", i.msgid), r(e.children || []).forEach(function(e) {
10694
+ e && e.nodeType && s.appendChild(e);
10695
+ }), a.appendChild(s), a._slot = s, a._tokuiType = "quote", a;
10696
+ }), e.register("sandbox", (e, r) => {
10697
+ var i = e.attrs || {}, a = i.lang || "", o = i.title || n("sandbox.title"), s = i.height || "200", c = t("div", { class: "tokui-sandbox" }), l = t("div", { class: "tokui-sandbox__header" }), u = t("span", { class: "tokui-sandbox__title" });
10698
+ if (u.textContent = o, l.appendChild(u), a) {
10699
+ var d = t("span", { class: "tokui-sandbox__lang" });
10700
+ d.textContent = a, l.appendChild(d);
10701
+ }
10702
+ c.appendChild(l);
10703
+ var f = t("div", { class: "tokui-sandbox__preview" });
10704
+ f.style.height = s + "px";
10705
+ var p = e.content || "";
10706
+ if (!p && e.children && (p = e.children.filter(function(e) {
10583
10707
  return e.type === "_text" && e.content;
10584
10708
  }).map(function(e) {
10585
10709
  return e.content;
10586
- }).join("")), i === "html") {
10587
- var p = t("iframe", {
10710
+ }).join("")), a === "html") {
10711
+ var m = t("iframe", {
10588
10712
  class: "tokui-sandbox__iframe",
10589
10713
  sandbox: "allow-scripts",
10590
10714
  frameborder: "0",
10591
10715
  title: e.attrs && (e.attrs.tt || e.attrs.title) || "sandbox"
10592
10716
  });
10593
- f && p.setAttribute("srcdoc", f), d.appendChild(p), s._slot = { appendChild: function(e) {
10594
- var t = e.nodeType === 3 ? e.nodeValue : e.textContent || "";
10595
- if (!t) return e;
10596
- var n = p.getAttribute("srcdoc") || "";
10597
- return p.setAttribute("srcdoc", n + t), e;
10598
- } };
10717
+ p && m.setAttribute("srcdoc", p), f.appendChild(m);
10718
+ var h = "";
10719
+ c._slot = { appendChild: function(e) {
10720
+ var t = e.nodeType === 3 ? e.nodeValue || e.textContent || "" : e.textContent || "";
10721
+ return t && (h += t), e;
10722
+ } }, c._streamCloseHook = function() {
10723
+ h && m.setAttribute("srcdoc", h);
10724
+ };
10599
10725
  } else {
10600
- var m = t("pre", { class: "tokui-sandbox__code" });
10601
- f && (m.textContent = f), n((e.children || []).filter(function(e) {
10726
+ var g = t("pre", { class: "tokui-sandbox__code" }), _ = t("code", {});
10727
+ p && (_.textContent = p), g.appendChild(_), g.__code = _, r((e.children || []).filter(function(e) {
10602
10728
  return e.type !== "_text";
10603
10729
  })).forEach(function(e) {
10604
- e && e.nodeType && m.appendChild(e);
10605
- }), d.appendChild(m), s._slot = d;
10730
+ e && e.nodeType && g.appendChild(e);
10731
+ }), f.appendChild(g), c._slot = _;
10606
10732
  }
10607
- return s.appendChild(d), s._tokuiType = "sandbox", s;
10733
+ return c.appendChild(f), c._tokuiType = "sandbox", c;
10608
10734
  }), e.register("commit", (e) => {
10609
10735
  var n = e.attrs || {}, r = t("div", { class: "tokui-commit" }), i = n.hash || "", a = n.msg || "", o = n.author || "", s = n.branch || "", c = n.time || "", l = n.additions || "", u = n.deletions || "", d = t("div", { class: "tokui-commit__row" });
10610
10736
  if (i) {
@@ -10642,8 +10768,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10642
10768
  r.appendChild(v);
10643
10769
  }
10644
10770
  return r;
10645
- }), e.register("test-result", (e, n) => {
10646
- var r = e.attrs || {}, i = t("div", { class: "tokui-test-result" }), a = t("div", { class: "tokui-test-result__summary" });
10771
+ }), e.register("test-result", (e, r) => {
10772
+ var i = e.attrs || {}, a = t("div", { class: "tokui-test-result" }), o = t("div", { class: "tokui-test-result__summary" });
10647
10773
  if ([
10648
10774
  {
10649
10775
  key: "pass",
@@ -10661,25 +10787,25 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10661
10787
  icon: "○"
10662
10788
  }
10663
10789
  ].forEach(function(e) {
10664
- if (r[e.key]) {
10790
+ if (i[e.key]) {
10665
10791
  var n = t("span", { class: "tokui-test-result__count tokui-test-result__count" + e.cls });
10666
- n.textContent = e.icon + " " + r[e.key], a.appendChild(n);
10792
+ n.textContent = e.icon + " " + i[e.key], o.appendChild(n);
10667
10793
  }
10668
- }), r.total) {
10669
- var o = t("span", { class: "tokui-test-result__count tokui-test-result__count--total" });
10670
- o.textContent = "Total: " + r.total, a.appendChild(o);
10794
+ }), i.total) {
10795
+ var s = t("span", { class: "tokui-test-result__count tokui-test-result__count--total" });
10796
+ s.textContent = n("testResult.total", { n: i.total }), o.appendChild(s);
10671
10797
  }
10672
- if (r.duration) {
10673
- var s = t("span", { class: "tokui-test-result__duration" });
10674
- s.textContent = r.duration, a.appendChild(s);
10798
+ if (i.duration) {
10799
+ var c = t("span", { class: "tokui-test-result__duration" });
10800
+ c.textContent = i.duration, o.appendChild(c);
10675
10801
  }
10676
- i.appendChild(a);
10677
- var c = t("div", { class: "tokui-test-result__cases" });
10678
- return n(e.children || []).forEach(function(e) {
10679
- e && e.nodeType && c.appendChild(e);
10680
- }), i.appendChild(c), i._slot = c, i._tokuiType = "test-result", i;
10802
+ a.appendChild(o);
10803
+ var l = t("div", { class: "tokui-test-result__cases" });
10804
+ return r(e.children || []).forEach(function(e) {
10805
+ e && e.nodeType && l.appendChild(e);
10806
+ }), a.appendChild(l), a._slot = l, a._tokuiType = "test-result", a;
10681
10807
  });
10682
- function k(e) {
10808
+ function A(e) {
10683
10809
  var n = e.attrs || {}, r = n.status || "pass", i = t("div", {
10684
10810
  class: "tokui-test-case tokui-test-case--" + r,
10685
10811
  "data-tokui-tag": e.type
@@ -10700,38 +10826,38 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10700
10826
  }
10701
10827
  return i;
10702
10828
  }
10703
- e.register("test-case", (e) => k(e)), e.register("case", (e) => k(e)), e.register("conversations", (r, i) => {
10829
+ e.register("test-case", (e) => A(e)), e.register("case", (e) => A(e)), e.register("conversations", (r, i) => {
10704
10830
  var a = r.attrs || {}, o = a.clk || "", s = a.act || "", c = t("div", {
10705
10831
  class: "tokui-conversations",
10706
10832
  role: "list"
10707
10833
  }), l = e.createReporter("conversations", a, c), u = (r.children || []).filter(function(e) {
10708
10834
  return e.type === "conv";
10709
10835
  }), d = null;
10710
- if (u.length === 0) return d = t("div", { class: "tokui-conversations__empty" }), d.textContent = n("chat.emptySessions"), c.appendChild(d), c._slot = c, c._tokuiType = "conversations", c._convHandlerName = o, c._convActiveAct = s, c._renderConvChild = function(e) {
10711
- return M(e, o, s, c, l);
10836
+ if (u.length === 0) return d = t("div", { class: "tokui-conversations__empty" }), d.textContent = n("chat.emptySessions"), c.appendChild(d), c._slot = c, c._tokuiType = "conversations", c._convHandlerName = o, c._convActiveAct = s, c._renderConvChild = function(t) {
10837
+ return N(t, o, s, c, l, e.eventBus);
10712
10838
  }, c._streamCloseHook = function() {
10713
10839
  c.querySelector(".tokui-conv") && d && d.parentNode && d.parentNode.removeChild(d);
10714
10840
  }, c;
10715
- var f = j(u);
10716
- return f.forEach(function(e) {
10841
+ var f = M(u);
10842
+ return f.forEach(function(n) {
10717
10843
  if (f.length > 1) {
10718
- var n = t("div", { class: "tokui-conversations__group-header" });
10719
- n.textContent = e.label, c.appendChild(n);
10844
+ var r = t("div", { class: "tokui-conversations__group-header" });
10845
+ r.textContent = n.label, c.appendChild(r);
10720
10846
  }
10721
- e.items.forEach(function(e) {
10722
- var t = M(e, o, s, c, l);
10723
- c.appendChild(t);
10847
+ n.items.forEach(function(t) {
10848
+ var n = N(t, o, s, c, l, e.eventBus);
10849
+ c.appendChild(n);
10724
10850
  });
10725
10851
  }), c._slot = c, c._tokuiType = "conversations", c;
10726
- }), e.register("conv", (e) => M(e, "", "", null, null));
10727
- function A(e) {
10852
+ }), e.register("conv", (t) => N(t, "", "", null, null, e.eventBus));
10853
+ function j(e) {
10728
10854
  return /^\d{1,2}:\d{2}$/.test(e);
10729
10855
  }
10730
- function j(e) {
10856
+ function M(e) {
10731
10857
  var t = [], r = [], i = [];
10732
10858
  e.forEach(function(e) {
10733
- var n = e.attrs && e.attrs.time || "";
10734
- A(n) ? t.push(e) : n === "昨天" ? r.push(e) : i.push(e);
10859
+ var a = e.attrs && e.attrs.time || "";
10860
+ j(a) ? t.push(e) : a === n("time.yesterday") ? r.push(e) : i.push(e);
10735
10861
  });
10736
10862
  var a = [];
10737
10863
  return t.length && a.push({
@@ -10748,47 +10874,41 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10748
10874
  items: e
10749
10875
  }];
10750
10876
  }
10751
- function M(e, r, i, a, o) {
10752
- var s = e.attrs || {}, c = s.tt || "", l = s.time || "", u = s.id || c, d = s.active === !0 || s.active === "true";
10753
- !d && i && s.act && s.act === i && (d = !0);
10754
- var f = ["tokui-conv"];
10755
- d && f.push("tokui-conv--active");
10756
- var p = t("div", {
10757
- class: f.join(" "),
10877
+ function N(e, r, i, a, o, s) {
10878
+ var c = e.attrs || {}, l = c.tt || "", u = c.time || "", d = c.id || l, f = c.active === !0 || c.active === "true";
10879
+ !f && i && c.act && c.act === i && (f = !0);
10880
+ var p = ["tokui-conv"];
10881
+ f && p.push("tokui-conv--active");
10882
+ var m = t("div", {
10883
+ class: p.join(" "),
10758
10884
  role: "listitem",
10759
10885
  tabindex: "0",
10760
10886
  "data-tokui-tag": "conv"
10761
10887
  });
10762
- d && p.setAttribute("aria-current", "true");
10763
- var m = t("div", { class: "tokui-conv__title" });
10764
- if (m.textContent = c, p.appendChild(m), l) {
10765
- var h = t("span", { class: "tokui-conv__time" });
10766
- h.textContent = l, p.appendChild(h);
10888
+ f && m.setAttribute("aria-current", "true");
10889
+ var h = t("div", { class: "tokui-conv__title" });
10890
+ if (h.textContent = l, m.appendChild(h), u) {
10891
+ var g = t("span", { class: "tokui-conv__time" });
10892
+ g.textContent = u, m.appendChild(g);
10767
10893
  }
10768
- var g = t("div", { class: "tokui-conv__actions" }), _ = t("button", {
10894
+ var _ = t("div", { class: "tokui-conv__actions" }), v = t("button", {
10769
10895
  class: "tokui-conv__delete",
10770
10896
  type: "button",
10771
10897
  "aria-label": n("common.delete")
10772
10898
  });
10773
- return _.textContent = "×", g.appendChild(_), p.appendChild(g), p.addEventListener("click", function(e) {
10774
- if (!(e.target.closest && e.target.closest(".tokui-conv__delete"))) {
10775
- if ((a ? a.querySelectorAll(".tokui-conv") : [p]).forEach(function(e) {
10776
- e.classList.remove("tokui-conv--active"), e.removeAttribute("aria-current");
10777
- }), p.classList.add("tokui-conv--active"), p.setAttribute("aria-current", "true"), r) {
10778
- var t = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
10779
- t && typeof t.emit == "function" && t.emit(r, {
10780
- tt: c,
10781
- time: l,
10782
- act: s.act || ""
10783
- });
10784
- }
10785
- o && o("change", { value: u });
10786
- }
10787
- }), p.addEventListener("keydown", function(e) {
10788
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p.click());
10789
- }), _.addEventListener("click", function(e) {
10790
- e.stopPropagation(), p.parentNode && p.parentNode.removeChild(p), o && o("delete", { value: u });
10791
- }), p;
10899
+ return v.textContent = "×", _.appendChild(v), m.appendChild(_), m.addEventListener("click", function(e) {
10900
+ e.target.closest && e.target.closest(".tokui-conv__delete") || ((a ? a.querySelectorAll(".tokui-conv") : [m]).forEach(function(e) {
10901
+ e.classList.remove("tokui-conv--active"), e.removeAttribute("aria-current");
10902
+ }), m.classList.add("tokui-conv--active"), m.setAttribute("aria-current", "true"), r && s && typeof s.emit == "function" && s.emit(r, {
10903
+ tt: l,
10904
+ time: u,
10905
+ act: c.act || ""
10906
+ }), o && o("change", { value: d }));
10907
+ }), m.addEventListener("keydown", function(e) {
10908
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), m.click());
10909
+ }), v.addEventListener("click", function(e) {
10910
+ e.stopPropagation(), m.parentNode && m.parentNode.removeChild(m), o && o("delete", { value: d });
10911
+ }), m;
10792
10912
  }
10793
10913
  e.register("welcome", (e, n) => {
10794
10914
  var r = e.attrs || {}, i = r.tt || "", a = r.st || "", o = r.bd ? String(r.bd).split(",") : [], s = r.hd || "", c = r.ft || "", l = t("div", { class: "tokui-welcome" });
@@ -10827,8 +10947,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10827
10947
  }
10828
10948
  return l._slot = h, l._tokuiType = "welcome", l;
10829
10949
  });
10830
- function N(e) {
10831
- var n = e.attrs || {}, r = n.tt || "", i = n.tx || "", a = n.i || "code", o = n.clk || "", s = {
10950
+ function P(n) {
10951
+ var r = n.attrs || {}, i = r.tt || "", a = r.tx || "", o = r.i || "code", s = r.clk || "", c = {
10832
10952
  code: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/></svg>",
10833
10953
  chart: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"20\" x2=\"18\" y2=\"10\"/><line x1=\"12\" y1=\"20\" x2=\"12\" y2=\"4\"/><line x1=\"6\" y1=\"20\" x2=\"6\" y2=\"14\"/></svg>",
10834
10954
  doc: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"/><polyline points=\"14 2 14 8 20 8\"/><line x1=\"16\" y1=\"13\" x2=\"8\" y2=\"13\"/><line x1=\"16\" y1=\"17\" x2=\"8\" y2=\"17\"/></svg>",
@@ -10837,35 +10957,39 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10837
10957
  chat: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z\"/></svg>",
10838
10958
  table: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"1\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"/><line x1=\"9\" y1=\"10\" x2=\"9\" y2=\"20\"/></svg>",
10839
10959
  form: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 11l3 3L22 4\"/><path d=\"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11\"/></svg>"
10840
- }, c = {
10841
- class: ["tokui-welcome-feature", "tokui-welcome-feature--" + a].join(" "),
10960
+ }, l = {
10961
+ class: ["tokui-welcome-feature", "tokui-welcome-feature--" + o].join(" "),
10842
10962
  role: "button",
10843
10963
  tabindex: "0",
10844
- "data-tokui-tag": e.type
10964
+ "data-tokui-tag": n.type
10845
10965
  };
10846
- o && (c["data-tokui-clk"] = o), Object.keys(n).forEach(function(e) {
10847
- e.indexOf("data-") === 0 && (c[e] = n[e]);
10966
+ s && (l["data-tokui-clk"] = s), Object.keys(r).forEach(function(e) {
10967
+ e.indexOf("data-") === 0 && (l[e] = r[e]);
10848
10968
  });
10849
- var l = t("div", c), u = t("div", { class: "tokui-welcome-feature__icon" });
10850
- u.innerHTML = s[a] || s.code, l.appendChild(u);
10851
- var d = t("div", { class: "tokui-welcome-feature__body" });
10852
- if (r) {
10853
- var f = t("div", { class: "tokui-welcome-feature__title" });
10854
- f.textContent = r, d.appendChild(f);
10855
- }
10969
+ var u = t("div", l), d = t("div", { class: "tokui-welcome-feature__icon" });
10970
+ d.innerHTML = c[o] || c.code, u.appendChild(d);
10971
+ var f = t("div", { class: "tokui-welcome-feature__body" });
10856
10972
  if (i) {
10857
- var p = t("div", { class: "tokui-welcome-feature__desc" });
10858
- p.textContent = i, d.appendChild(p);
10973
+ var p = t("div", { class: "tokui-welcome-feature__title" });
10974
+ p.textContent = i, f.appendChild(p);
10859
10975
  }
10860
- return l.appendChild(d), l._tokuiType = "welcome-feature", l;
10976
+ if (a) {
10977
+ var m = t("div", { class: "tokui-welcome-feature__desc" });
10978
+ m.textContent = a, f.appendChild(m);
10979
+ }
10980
+ u.appendChild(f);
10981
+ var h = e.createReporter("welcome-feature", r, u);
10982
+ return u.addEventListener("click", function() {
10983
+ h("select", { value: i || a });
10984
+ }), u._tokuiType = "welcome-feature", u;
10861
10985
  }
10862
- e.register("welcome-feature", (e) => N(e)), e.register("feature", (e) => N(e)), e.register("attachments", (e, n) => {
10986
+ e.register("welcome-feature", (e) => P(e)), e.register("feature", (e) => P(e)), e.register("attachments", (e, n) => {
10863
10987
  var r = (e.attrs || {}).clk || "", i = t("div", { class: "tokui-attachments" });
10864
10988
  return r && i.setAttribute("data-tokui-clk", r), n(e.children || []).forEach(function(e) {
10865
10989
  e && e.nodeType && i.appendChild(e);
10866
10990
  }), i._slot = i, i._tokuiType = "attachments", i;
10867
- }), e.register("attach", (e) => {
10868
- var r = e.attrs || {}, i = r.t || "default", a = r.s || n("file.unnamed"), o = r.u || "", s = r.size || "", l = r.clk || "", u = {
10991
+ }), e.register("attach", (r) => {
10992
+ var i = r.attrs || {}, a = i.t || "default", o = i.s || n("file.unnamed"), s = i.u || "", c = i.size || "", l = i.clk || "", u = {
10869
10993
  pdf: "#f5222d",
10870
10994
  code: "#1677ff",
10871
10995
  excel: "#52c41a",
@@ -10876,147 +11000,150 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10876
11000
  audio: "#13c2c2",
10877
11001
  image: "#eb2f96",
10878
11002
  default: "#8c8c8c"
10879
- }, d = u[i] || u.default, f = t("div", { class: "tokui-attach tokui-attach--" + i });
10880
- if (l && f.setAttribute("data-tokui-clk", l), i === "image" && o) {
10881
- var p = t("img", {
11003
+ }, f = u[a] || u.default, p = t("div", { class: "tokui-attach tokui-attach--" + a });
11004
+ if (l && p.setAttribute("data-tokui-clk", l), a === "image" && s) {
11005
+ var m = t("img", {
10882
11006
  class: "tokui-attach__thumb",
10883
- src: o,
10884
- alt: a
11007
+ src: s,
11008
+ alt: o
10885
11009
  });
10886
- f.appendChild(p);
11010
+ p.appendChild(m);
10887
11011
  } else {
10888
- var m = t("div", { class: "tokui-attach__icon" });
10889
- m.innerHTML = c(i, d), f.appendChild(m);
10890
- }
10891
- var h = t("div", { class: "tokui-attach__info" }), g = t("div", { class: "tokui-attach__name" });
10892
- if (g.textContent = a, o && (g.style.cursor = "pointer", g.setAttribute("tabindex", "0"), g.setAttribute("role", "link"), g.addEventListener("click", function() {
10893
- typeof window < "u" && window.open(o, "_blank");
10894
- }), g.addEventListener("keydown", function(e) {
10895
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), typeof window < "u" && window.open(o, "_blank"));
10896
- })), h.appendChild(g), s) {
10897
- var _ = t("div", { class: "tokui-attach__size" });
10898
- _.textContent = s, h.appendChild(_);
10899
- }
10900
- f.appendChild(h);
10901
- var v = t("div", { class: "tokui-attach__actions" });
10902
- if (o) {
10903
- var y = t("a", {
11012
+ var h = t("div", { class: "tokui-attach__icon" });
11013
+ h.innerHTML = d(a, f), p.appendChild(h);
11014
+ }
11015
+ var g = t("div", { class: "tokui-attach__info" }), _ = t("div", { class: "tokui-attach__name" });
11016
+ if (_.textContent = o, s && (_.style.cursor = "pointer", _.setAttribute("tabindex", "0"), _.setAttribute("role", "link"), _.addEventListener("click", function() {
11017
+ typeof window < "u" && window.open(s, "_blank");
11018
+ }), _.addEventListener("keydown", function(e) {
11019
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), typeof window < "u" && window.open(s, "_blank"));
11020
+ })), g.appendChild(_), c) {
11021
+ var v = t("div", { class: "tokui-attach__size" });
11022
+ v.textContent = c, g.appendChild(v);
11023
+ }
11024
+ p.appendChild(g);
11025
+ var y = t("div", { class: "tokui-attach__actions" }), b = e.createReporter("attach", i, p);
11026
+ if (s) {
11027
+ var x = t("a", {
10904
11028
  class: "tokui-attach__action",
10905
- href: o,
11029
+ href: s,
10906
11030
  target: "_blank",
10907
11031
  rel: "noopener noreferrer",
10908
11032
  download: ""
10909
11033
  });
10910
- y.innerHTML = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M8 2v9M4.5 7.5L8 11l3.5-3.5M2 13h12\"/></svg>", y.title = n("common.download"), v.appendChild(y);
11034
+ x.innerHTML = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M8 2v9M4.5 7.5L8 11l3.5-3.5M2 13h12\"/></svg>", x.title = n("common.download"), y.appendChild(x);
10911
11035
  }
10912
- var b = t("button", {
11036
+ var S = t("button", {
10913
11037
  class: "tokui-attach__action tokui-attach__action--del",
10914
11038
  type: "button"
10915
11039
  });
10916
- return b.innerHTML = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 4l8 8M12 4l-8 8\"/></svg>", b.title = n("common.delete"), b.addEventListener("click", function(e) {
10917
- if (e.stopPropagation(), l) {
10918
- var t = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
10919
- t && typeof t.emit == "function" && t.emit(l, {
10920
- name: a,
10921
- url: o,
10922
- type: i
10923
- });
10924
- }
10925
- f.parentNode && f.parentNode.removeChild(f);
10926
- }), v.appendChild(b), f.appendChild(v), f._tokuiType = "attach", f;
10927
- }), e.register("artifact", (r, o) => {
11040
+ return S.innerHTML = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 4l8 8M12 4l-8 8\"/></svg>", S.title = n("common.delete"), S.addEventListener("click", function(t) {
11041
+ t.stopPropagation(), l && e.eventBus && typeof e.eventBus.emit == "function" && e.eventBus.emit(l, {
11042
+ name: o,
11043
+ url: s,
11044
+ type: a
11045
+ }), b("delete", {
11046
+ name: o,
11047
+ url: s,
11048
+ type: a
11049
+ }), p.parentNode && p.parentNode.removeChild(p);
11050
+ }), y.appendChild(S), p.appendChild(y), p._tokuiType = "attach", p;
11051
+ }), e.register("artifact", (r, i) => {
10928
11052
  var s = r.attrs || {}, c = s.tt || "Artifact", l = s.lang || "text";
10929
11053
  s.pos, s.w;
10930
- var u = t("div", { class: "tokui-artifact" }), d = t("div", { class: "tokui-artifact__header" }), f = t("span", { class: "tokui-artifact__title" });
10931
- f.textContent = c, d.appendChild(f);
10932
- var p = t("div", {
11054
+ var u = { class: "tokui-artifact" };
11055
+ s.id && (u.id = s.id);
11056
+ var d = t("div", u), f = t("div", { class: "tokui-artifact__header" }), p = t("span", { class: "tokui-artifact__title" });
11057
+ p.textContent = c, f.appendChild(p);
11058
+ var m = t("div", {
10933
11059
  class: "tokui-artifact__tabs",
10934
11060
  role: "tablist"
10935
- }), m = t("button", {
11061
+ }), h = t("button", {
10936
11062
  class: "tokui-artifact__tab tokui-artifact__tab--code tokui-artifact__tab--active",
10937
11063
  type: "button",
10938
11064
  role: "tab",
10939
11065
  "aria-selected": "true"
10940
11066
  });
10941
- m.textContent = "Code", p.appendChild(m);
10942
- var h = t("button", {
11067
+ h.textContent = n("artifact.codeTab"), m.appendChild(h);
11068
+ var g = t("button", {
10943
11069
  class: "tokui-artifact__tab tokui-artifact__tab--preview",
10944
11070
  type: "button",
10945
11071
  role: "tab",
10946
11072
  "aria-selected": "false"
10947
11073
  });
10948
- h.textContent = "Preview", p.appendChild(h), d.appendChild(p);
10949
- var g = t("button", {
11074
+ g.textContent = n("artifact.previewTab"), m.appendChild(g), f.appendChild(m);
11075
+ var _ = t("button", {
10950
11076
  class: "tokui-artifact__close",
10951
11077
  type: "button",
10952
11078
  "aria-label": n("common.close")
10953
11079
  });
10954
- g.innerHTML = "&times;", d.appendChild(g), u.appendChild(d);
10955
- var _ = t("div", { class: "tokui-artifact__code" }), v = "", y = (r.children || []).filter(function(e) {
11080
+ _.innerHTML = "&times;", f.appendChild(_), d.appendChild(f);
11081
+ var v = t("div", { class: "tokui-artifact__code" }), y = "", b = (r.children || []).filter(function(e) {
10956
11082
  return e.type === "artifact-code";
10957
11083
  });
10958
- y.length > 0 && (v = (y[0].children || []).map(function(e) {
11084
+ b.length > 0 && (y = (b[0].children || []).map(function(e) {
10959
11085
  return e.content || "";
10960
11086
  }).join(""));
10961
- var b = t("pre", { class: "tokui-code" }), x = t("code", { class: "language-" + l });
10962
- l !== "text" && i[l] ? x.innerHTML = w(a(v, l)) : x.innerHTML = w(C(v)), b.appendChild(x), _.appendChild(b);
10963
- var S = t("button", {
11087
+ var x = t("pre", { class: "tokui-code" }), S = t("code", { class: "language-" + l });
11088
+ l !== "text" && a[l] ? S.innerHTML = T(o(y, l)) : S.innerHTML = T(w(y)), x.appendChild(S), v.appendChild(x);
11089
+ var C = y, E = e.createReporter("artifact", s, d), D = t("button", {
10964
11090
  class: "tokui-artifact__code-copy",
10965
11091
  type: "button"
10966
11092
  });
10967
- S.textContent = n("common.copy"), S.addEventListener("click", function() {
10968
- var e = x.textContent || "";
10969
- typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(e), S.textContent = n("common.copied"), S.classList.add("tokui-artifact__code-copy--done"), setTimeout(function() {
10970
- S.textContent = n("common.copy"), S.classList.remove("tokui-artifact__code-copy--done");
11093
+ D.textContent = n("common.copy"), D.addEventListener("click", function() {
11094
+ typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(C), E("copy", {}), D.textContent = n("common.copied"), D.classList.add("tokui-artifact__code-copy--done"), setTimeout(function() {
11095
+ D.textContent = n("common.copy"), D.classList.remove("tokui-artifact__code-copy--done");
10971
11096
  }, 2e3);
10972
- }), _.appendChild(S), u.appendChild(_);
10973
- var T = t("div", { class: "tokui-artifact__preview" });
10974
- T.style.display = "none";
10975
- var E = t("iframe", {
11097
+ }), v.appendChild(D), d.appendChild(v);
11098
+ var O = t("div", { class: "tokui-artifact__preview" });
11099
+ O.style.display = "none";
11100
+ var k = t("iframe", {
10976
11101
  class: "tokui-artifact__iframe",
10977
11102
  sandbox: "allow-scripts",
10978
11103
  frameborder: "0",
10979
11104
  title: c || "artifact"
10980
- }), D = "";
10981
- D = l === "html" ? v : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + v.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", E.setAttribute("srcdoc", D), T.appendChild(E), u.appendChild(T);
10982
- var O = t("div", { class: "tokui-artifact__resize" });
10983
- u.appendChild(O), m.addEventListener("click", function() {
10984
- _.style.display = "", T.style.display = "none", m.classList.add("tokui-artifact__tab--active"), h.classList.remove("tokui-artifact__tab--active"), m.setAttribute("aria-selected", "true"), h.setAttribute("aria-selected", "false");
10985
- }), h.addEventListener("click", function() {
10986
- _.style.display = "none", T.style.display = "", h.classList.add("tokui-artifact__tab--active"), m.classList.remove("tokui-artifact__tab--active"), h.setAttribute("aria-selected", "true"), m.setAttribute("aria-selected", "false");
10987
- });
10988
- var k = e.createReporter("artifact", s, u);
10989
- g.addEventListener("click", function() {
10990
- if (k("close", {}), typeof CustomEvent == "function" && typeof u.dispatchEvent == "function") {
11105
+ }), A = "";
11106
+ A = l === "html" ? y : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + y.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", k.setAttribute("srcdoc", A), O.appendChild(k), d.appendChild(O);
11107
+ var j = t("div", { class: "tokui-artifact__resize" });
11108
+ d.appendChild(j), h.addEventListener("click", function() {
11109
+ v.style.display = "", O.style.display = "none", h.classList.add("tokui-artifact__tab--active"), g.classList.remove("tokui-artifact__tab--active"), h.setAttribute("aria-selected", "true"), g.setAttribute("aria-selected", "false");
11110
+ }), g.addEventListener("click", function() {
11111
+ v.style.display = "none", O.style.display = "", g.classList.add("tokui-artifact__tab--active"), h.classList.remove("tokui-artifact__tab--active"), g.setAttribute("aria-selected", "true"), h.setAttribute("aria-selected", "false");
11112
+ }), _.addEventListener("click", function() {
11113
+ if (E("close", {}), typeof CustomEvent == "function" && typeof d.dispatchEvent == "function") {
10991
11114
  var e = new CustomEvent("tokui-artifact-close", {
10992
11115
  bubbles: !0,
10993
- detail: { artifact: u }
11116
+ detail: { artifact: d }
10994
11117
  });
10995
- u.dispatchEvent(e);
11118
+ d.dispatchEvent(e);
10996
11119
  }
10997
- u.style.display = "none";
11120
+ d.style.display = "none";
10998
11121
  });
10999
- var A = !1;
11000
- O.addEventListener("mousedown", function(e) {
11001
- A = !0, e.preventDefault(), document.addEventListener("mousemove", j), document.addEventListener("mouseup", M);
11122
+ var M = !1;
11123
+ j.addEventListener("mousedown", function(e) {
11124
+ M = !0, e.preventDefault(), document.addEventListener("mousemove", N), document.addEventListener("mouseup", P);
11002
11125
  });
11003
- function j(e) {
11004
- if (A) {
11005
- var t = u.getBoundingClientRect();
11126
+ function N(e) {
11127
+ if (M) {
11128
+ var t = d.getBoundingClientRect();
11006
11129
  if (t) {
11007
11130
  var n = t.bottom - e.clientY;
11008
- n = Math.max(120, n), u.style.height = n + "px";
11131
+ n = Math.max(120, n), d.style.height = n + "px";
11009
11132
  }
11010
11133
  }
11011
11134
  }
11012
- function M() {
11013
- A = !1, document.removeEventListener("mousemove", j), document.removeEventListener("mouseup", M);
11014
- }
11015
- return u._slot = x, u._tokuiType = "artifact", u._artifactCode = v, setTimeout(function() {
11016
- u.querySelectorAll(".tokui-artifact-preview-standalone").forEach(function(e) {
11135
+ function P() {
11136
+ M = !1, document.removeEventListener("mousemove", N), document.removeEventListener("mouseup", P);
11137
+ }
11138
+ return typeof document < "u" && e._registerCleanup(d, function() {
11139
+ P();
11140
+ }), d._slot = S, d._tokuiType = "artifact", d._artifactCode = y, d._streamAppendHook = function(e) {
11141
+ e && e.type === "_text" && e.content && (C += e.content);
11142
+ }, setTimeout(function() {
11143
+ d.querySelectorAll(".tokui-artifact-preview-standalone").forEach(function(e) {
11017
11144
  e.parentNode && e.parentNode.removeChild(e);
11018
11145
  });
11019
- }, 0), u._streamCloseHook = function() {
11146
+ }, 0), d._streamCloseHook = function() {
11020
11147
  var e = (r.children || []).find(function(e) {
11021
11148
  return e.type === "artifact-code";
11022
11149
  }), t;
@@ -11025,21 +11152,21 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11025
11152
  }).join("");
11026
11153
  else {
11027
11154
  t = "";
11028
- for (var n = u.querySelectorAll("pre"), o = 0; o < n.length; o++) if (n[o]._tokuiType === "artifact-code") {
11029
- var s = n[o].querySelector("code");
11155
+ for (var n = d.querySelectorAll("pre"), i = 0; i < n.length; i++) if (n[i]._tokuiType === "artifact-code") {
11156
+ var s = n[i].querySelector("code");
11030
11157
  if (s) {
11031
11158
  t = s.textContent || "";
11032
11159
  break;
11033
11160
  }
11034
11161
  }
11035
- t ||= u._artifactCode || "";
11162
+ t ||= C || d._artifactCode || "";
11036
11163
  }
11037
- l !== "text" && i[l] ? x.innerHTML = w(a(t, l)) : x.innerHTML = w(C(t)), u._artifactCode = t;
11164
+ l !== "text" && a[l] ? S.innerHTML = T(o(t, l)) : S.innerHTML = T(w(t)), d._artifactCode = t, C = t;
11038
11165
  var c = "";
11039
- c = l === "html" ? t : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", E.setAttribute("srcdoc", c);
11040
- var d = u.querySelector(".tokui-artifact-preview-standalone");
11041
- d && d.parentNode && d.parentNode.removeChild(d);
11042
- }, u;
11166
+ c = l === "html" ? t : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", k.setAttribute("srcdoc", c);
11167
+ var u = d.querySelector(".tokui-artifact-preview-standalone");
11168
+ u && u.parentNode && u.parentNode.removeChild(u);
11169
+ }, d;
11043
11170
  }), e.register("artifact-code", (e, n) => {
11044
11171
  var r = "";
11045
11172
  r = e.children && e.children.length > 0 ? e.children.map(function(e) {
@@ -11064,44 +11191,44 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11064
11191
  return e.children && e.children.length > 0 && (s = e.children.map(function(e) {
11065
11192
  return e.content || "";
11066
11193
  }).join("")), s && o.setAttribute("srcdoc", s), a.appendChild(o), a._tokuiType = "artifact-preview", a;
11067
- }), e.register("command", (e, r) => {
11068
- var i = e.attrs || {}, a = i.ph || n("command.placeholder"), o = t("div", { class: "tokui-command" });
11069
- i.id && (o.id = i.id), i.clk && o.setAttribute("data-tokui-cmd-clk", i.clk);
11070
- var s = t("div", { class: "tokui-command__overlay" });
11071
- o.appendChild(s);
11072
- var c = t("div", {
11194
+ }), e.register("command", (r, i) => {
11195
+ var a = r.attrs || {}, o = a.ph || n("command.placeholder"), s = t("div", { class: "tokui-command" });
11196
+ a.id && (s.id = a.id), a.clk && s.setAttribute("data-tokui-cmd-clk", a.clk);
11197
+ var c = e.createReporter("command", a, s), l = t("div", { class: "tokui-command__overlay" });
11198
+ s.appendChild(l);
11199
+ var u = t("div", {
11073
11200
  class: "tokui-command__panel",
11074
11201
  role: "dialog",
11075
11202
  "aria-modal": "true",
11076
11203
  "aria-label": n("command.aria")
11077
- }), l = t("div", { class: "tokui-command__input-wrap" }), u = t("span", {
11204
+ }), d = t("div", { class: "tokui-command__input-wrap" }), f = t("span", {
11078
11205
  class: "tokui-command__search-icon",
11079
11206
  "aria-hidden": "true"
11080
11207
  });
11081
- u.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"M21 21l-4.35-4.35\"/></svg>", l.appendChild(u);
11082
- var d = t("input", {
11208
+ f.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"M21 21l-4.35-4.35\"/></svg>", d.appendChild(f);
11209
+ var p = t("input", {
11083
11210
  class: "tokui-command__input",
11084
11211
  type: "text",
11085
- placeholder: a,
11212
+ placeholder: o,
11086
11213
  autocomplete: "off",
11087
11214
  autofocus: "true"
11088
11215
  });
11089
- l.appendChild(d), c.appendChild(l);
11090
- var f = t("div", {
11216
+ d.appendChild(p), u.appendChild(d);
11217
+ var m = t("div", {
11091
11218
  class: "tokui-command__list",
11092
11219
  role: "listbox"
11093
11220
  });
11094
- r(e.children || []).forEach(function(e) {
11095
- e && e.nodeType && f.appendChild(e);
11221
+ i(r.children || []).forEach(function(e) {
11222
+ e && e.nodeType && m.appendChild(e);
11096
11223
  });
11097
- var p = t("div", { class: "tokui-command__empty" });
11098
- p.textContent = n("command.noResult"), p.style.display = "none", f.appendChild(p), c.appendChild(f), o.appendChild(c);
11099
- var m = [], h = [];
11100
- function g() {
11101
- m = Array.from(f.querySelectorAll(".tokui-command__item")), h = Array.from(f.querySelectorAll(".tokui-command__group"));
11224
+ var h = t("div", { class: "tokui-command__empty" });
11225
+ h.textContent = n("command.noResult"), h.style.display = "none", m.appendChild(h), u.appendChild(m), s.appendChild(u);
11226
+ var g = [], _ = [];
11227
+ function v() {
11228
+ g = Array.from(m.querySelectorAll(".tokui-command__item")), _ = Array.from(m.querySelectorAll(".tokui-command__group"));
11102
11229
  }
11103
- g();
11104
- function _(e, t) {
11230
+ v();
11231
+ function y(e, t) {
11105
11232
  if (!t) return {
11106
11233
  match: !0,
11107
11234
  score: 0
@@ -11120,7 +11247,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11120
11247
  score: 0
11121
11248
  };
11122
11249
  }
11123
- function v(e, t) {
11250
+ function b(e, t) {
11124
11251
  if (!t) return document.createTextNode(e);
11125
11252
  var n = e.toLowerCase(), r = t.toLowerCase(), i = n.indexOf(r);
11126
11253
  if (i === -1) return document.createTextNode(e);
@@ -11129,138 +11256,121 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11129
11256
  var l = document.createElement("mark");
11130
11257
  return l.className = "tokui-command__highlight", l.textContent = s, a.appendChild(l), c && a.appendChild(document.createTextNode(c)), a;
11131
11258
  }
11132
- function y(e) {
11259
+ function x(e) {
11133
11260
  var t = 0;
11134
- m.forEach(function(n) {
11135
- var r = n.getAttribute("data-value") || n.textContent || "";
11136
- if (_(r, e).match) {
11261
+ g.forEach(function(n) {
11262
+ var r = n.getAttribute("data-value") || n.textContent || "", i = y(r, e);
11263
+ if (n._cmdVisible = i.match, i.match) {
11137
11264
  n.style.display = "", t++;
11138
- var i = n.querySelector(".tokui-command__item-text");
11139
- i && (i.innerHTML = "", i.appendChild(v(r, e)));
11265
+ var a = n.querySelector(".tokui-command__item-text");
11266
+ a && (a.innerHTML = "", a.appendChild(b(n._cmdText == null ? r : n._cmdText, e)));
11140
11267
  } else n.style.display = "none", n.classList.remove("tokui-command__item--selected");
11141
- }), h.forEach(function(e) {
11142
- var t = e.querySelectorAll(".tokui-command__item:not([style*=\"display: none\"])");
11143
- e.style.display = t.length === 0 ? "none" : "";
11144
- }), p.style.display = t === 0 ? "" : "none", b = -1, t > 0 && (b = 0, S());
11268
+ }), _.forEach(function(e) {
11269
+ for (var t = e.querySelectorAll(".tokui-command__item"), n = !1, r = 0; r < t.length; r++) if (t[r]._cmdVisible) {
11270
+ n = !0;
11271
+ break;
11272
+ }
11273
+ e.style.display = n ? "" : "none";
11274
+ }), h.style.display = t === 0 ? "" : "none", S = -1, t > 0 && (S = 0, w());
11145
11275
  }
11146
- d.addEventListener("input", function() {
11147
- y(d.value.trim());
11276
+ p.addEventListener("input", function() {
11277
+ x(p.value.trim());
11148
11278
  });
11149
- var b = -1;
11150
- function x() {
11151
- return m.filter(function(e) {
11152
- return e.style.display !== "none";
11279
+ var S = -1;
11280
+ function C() {
11281
+ return g.filter(function(e) {
11282
+ return e._cmdVisible !== !1;
11153
11283
  });
11154
11284
  }
11155
- function S() {
11156
- x().forEach(function(e, t) {
11157
- t === b ? (e.classList.add("tokui-command__item--selected"), e.setAttribute("aria-selected", "true"), e.scrollIntoView && e.scrollIntoView({ block: "nearest" })) : (e.classList.remove("tokui-command__item--selected"), e.setAttribute("aria-selected", "false"));
11285
+ function w() {
11286
+ C().forEach(function(e, t) {
11287
+ t === S ? (e.classList.add("tokui-command__item--selected"), e.setAttribute("aria-selected", "true"), e.scrollIntoView && e.scrollIntoView({ block: "nearest" })) : (e.classList.remove("tokui-command__item--selected"), e.setAttribute("aria-selected", "false"));
11158
11288
  });
11159
11289
  }
11160
- function C(e) {
11161
- if (e) {
11162
- var t = e.getAttribute("data-tokui-cmd-clk");
11163
- if (t) {
11164
- var n = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
11165
- n && typeof n.emit == "function" && n.emit(t, {
11166
- value: e.getAttribute("data-value"),
11167
- text: e.textContent
11168
- });
11169
- }
11170
- var r = o.getAttribute("data-tokui-cmd-clk");
11171
- if (r) {
11172
- var i = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
11173
- i && typeof i.emit == "function" && i.emit(r, {
11174
- value: e.getAttribute("data-value"),
11175
- text: e.textContent,
11176
- clk: t
11177
- });
11178
- }
11179
- T();
11180
- }
11181
- }
11182
- d.addEventListener("keydown", function(e) {
11183
- var t = x();
11184
- e.key === "ArrowDown" ? (e.preventDefault(), t.length > 0 && (b = (b + 1) % t.length, S())) : e.key === "ArrowUp" ? (e.preventDefault(), t.length > 0 && (b = b <= 0 ? t.length - 1 : b - 1, S())) : e.key === "Enter" ? (e.preventDefault(), b >= 0 && b < t.length && C(t[b])) : e.key === "Escape" && (e.preventDefault(), T());
11290
+ function T(t) {
11291
+ if (t) {
11292
+ var n = t.getAttribute("data-tokui-cmd-clk"), r = t.getAttribute("data-value"), i = t.querySelector ? t.querySelector(".tokui-command__item-text") : null, a = t._cmdText == null ? i ? i.textContent : t.textContent : t._cmdText, o = e.eventBus;
11293
+ n && o && typeof o.emit == "function" && o.emit(n, {
11294
+ value: r,
11295
+ text: a
11296
+ });
11297
+ var l = s.getAttribute("data-tokui-cmd-clk");
11298
+ l && o && typeof o.emit == "function" && o.emit(l, {
11299
+ value: r,
11300
+ text: a,
11301
+ clk: n
11302
+ }), c("select", {
11303
+ value: r,
11304
+ text: a
11305
+ }), D();
11306
+ }
11307
+ }
11308
+ p.addEventListener("keydown", function(e) {
11309
+ var t = C();
11310
+ e.key === "ArrowDown" ? (e.preventDefault(), t.length > 0 && (S = (S + 1) % t.length, w())) : e.key === "ArrowUp" ? (e.preventDefault(), t.length > 0 && (S = S <= 0 ? t.length - 1 : S - 1, w())) : e.key === "Enter" ? (e.preventDefault(), S >= 0 && S < t.length && T(t[S])) : e.key === "Escape" && (e.preventDefault(), D());
11185
11311
  });
11186
- function w() {
11187
- g(), y(d.value || ""), o.classList.add("tokui-command--open"), o._prevFocus = typeof document < "u" && document.activeElement || null;
11312
+ function E() {
11313
+ v(), x(p.value || ""), s.classList.add("tokui-command--open"), s._prevFocus = typeof document < "u" && document.activeElement || null;
11188
11314
  var e = function() {
11189
- o.classList.contains("tokui-command--open") && typeof d.focus == "function" && d.focus();
11315
+ s.classList.contains("tokui-command--open") && typeof p.focus == "function" && p.focus();
11190
11316
  };
11191
11317
  typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : setTimeout(e, 0);
11192
11318
  }
11193
- function T() {
11194
- o.classList.remove("tokui-command--open"), d.value = "", y(""), b = -1;
11195
- var e = o._prevFocus;
11319
+ function D() {
11320
+ s.classList.remove("tokui-command--open"), p.value = "", x(""), S = -1;
11321
+ var e = s._prevFocus;
11196
11322
  if (e && typeof e.focus == "function") try {
11197
11323
  e.focus();
11198
11324
  } catch {}
11199
- o._prevFocus = null;
11325
+ s._prevFocus = null;
11200
11326
  }
11201
- o.addEventListener("keydown", function(e) {
11202
- if (!(e.key !== "Tab" || !o.classList.contains("tokui-command--open"))) {
11203
- var t = c.querySelectorAll("input, button, [tabindex=\"0\"]");
11327
+ s.addEventListener("keydown", function(e) {
11328
+ if (!(e.key !== "Tab" || !s.classList.contains("tokui-command--open"))) {
11329
+ var t = u.querySelectorAll("input, button, [tabindex=\"0\"]");
11204
11330
  if (t.length) {
11205
11331
  var n = t[0], r = t[t.length - 1], i = typeof document < "u" ? document.activeElement : null;
11206
11332
  e.shiftKey && i === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && i === r && (e.preventDefault(), n.focus());
11207
11333
  }
11208
11334
  }
11209
- }), s.addEventListener("click", function() {
11210
- T();
11335
+ }), l.addEventListener("click", function() {
11336
+ D();
11211
11337
  });
11212
- function E(e) {
11213
- (e.metaKey || e.ctrlKey) && e.key === "k" && (e.preventDefault(), o.classList.contains("tokui-command--open") ? T() : w());
11214
- }
11215
- return i.hotkey !== void 0 && typeof document < "u" && document.addEventListener("keydown", E), o._tokuiType = "command", o._slot = f, o._openCommand = w, o._closeCommand = T, o._streamCloseHook = function() {
11216
- g(), y(d.value || "");
11217
- }, o;
11338
+ function O(e) {
11339
+ (e.metaKey || e.ctrlKey) && e.key === "k" && (e.preventDefault(), s.classList.contains("tokui-command--open") ? D() : E());
11340
+ }
11341
+ return a.hotkey !== void 0 && typeof document < "u" && (document.addEventListener("keydown", O), e._registerCleanup(s, function() {
11342
+ document.removeEventListener("keydown", O);
11343
+ })), s._tokuiType = "command", s._slot = m, s._openCommand = E, s._closeCommand = D, s._selectItem = T, s._hoverSelectItem = function(e) {
11344
+ var t = C().indexOf(e);
11345
+ t !== -1 && (S = t, w());
11346
+ }, s._streamCloseHook = function() {
11347
+ v(), x(p.value || "");
11348
+ }, s;
11218
11349
  });
11219
- function P(e) {
11220
- var n = e.attrs || {}, r = n.tx || "", i = n.v || r, a = t("div", {
11350
+ function F(e) {
11351
+ var n = e.attrs || {}, r = n.tx || "", i = t("div", {
11221
11352
  class: "tokui-command__item",
11222
11353
  role: "option",
11223
11354
  tabindex: "-1",
11224
- "data-value": i,
11355
+ "data-value": n.v || r,
11225
11356
  "aria-selected": "false",
11226
11357
  "data-tokui-tag": e.type
11227
11358
  });
11228
- n.clk && a.setAttribute("data-tokui-cmd-clk", n.clk);
11229
- var o = t("span", { class: "tokui-command__item-text" });
11230
- if (o.textContent = r, a.appendChild(o), n.shortcut) {
11231
- var s = t("span", { class: "tokui-command__item-shortcut" });
11232
- s.textContent = n.shortcut, a.appendChild(s);
11233
- }
11234
- return a.addEventListener("click", function() {
11235
- var e = a.closest ? a.closest(".tokui-command") : null;
11236
- if (e && e._closeCommand) {
11237
- var t = a.getAttribute("data-tokui-cmd-clk");
11238
- if (t) {
11239
- var n = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
11240
- n && typeof n.emit == "function" && n.emit(t, {
11241
- value: i,
11242
- text: r
11243
- });
11244
- }
11245
- var o = e.getAttribute("data-tokui-cmd-clk");
11246
- if (o) {
11247
- var s = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
11248
- s && typeof s.emit == "function" && s.emit(o, {
11249
- value: i,
11250
- text: r,
11251
- clk: t
11252
- });
11253
- }
11254
- e._closeCommand();
11255
- }
11256
- }), a.addEventListener("mouseenter", function() {
11257
- var e = a.closest ? a.closest(".tokui-command__list") : null;
11258
- e && (Array.from(e.querySelectorAll(".tokui-command__item:not([style*=\"display: none\"])")).forEach(function(e) {
11259
- e.classList.remove("tokui-command__item--selected"), e.setAttribute("aria-selected", "false");
11260
- }), a.classList.add("tokui-command__item--selected"), a.setAttribute("aria-selected", "true"));
11261
- }), a;
11359
+ n.clk && i.setAttribute("data-tokui-cmd-clk", n.clk);
11360
+ var a = t("span", { class: "tokui-command__item-text" });
11361
+ if (a.textContent = r, i.appendChild(a), i._cmdText = r, n.shortcut) {
11362
+ var o = t("span", { class: "tokui-command__item-shortcut" });
11363
+ o.textContent = n.shortcut, i.appendChild(o);
11364
+ }
11365
+ return i.addEventListener("click", function() {
11366
+ var e = i.closest ? i.closest(".tokui-command") : null;
11367
+ e && typeof e._selectItem == "function" && e._selectItem(i);
11368
+ }), i.addEventListener("mouseenter", function() {
11369
+ var e = i.closest ? i.closest(".tokui-command") : null;
11370
+ e && typeof e._hoverSelectItem == "function" && e._hoverSelectItem(i);
11371
+ }), i;
11262
11372
  }
11263
- typeof window < "u" && window.TokUI && window.TokUI._internal && (window.TokUI._internal.buildCommandItem = P), e.register("command-group", (e, n) => {
11373
+ typeof window < "u" && window.TokUI && window.TokUI._internal && (window.TokUI._internal.buildCommandItem = F), e.register("command-group", (e, n) => {
11264
11374
  var r = (e.attrs || {}).tt || "", i = t("div", {
11265
11375
  class: "tokui-command__group",
11266
11376
  role: "group"
@@ -11273,8 +11383,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11273
11383
  return n(e.children || []).forEach(function(e) {
11274
11384
  e && e.nodeType && i.appendChild(e);
11275
11385
  }), i._slot = i, i._tokuiType = "command-group", i;
11276
- }), e.register("command-item", (e) => P(e)), e.register("canvas", (e, r) => {
11277
- var i = e.attrs || {}, a = i.tt || "Canvas", o = i.pos || "right", s = parseInt(i.w) || 400, c = i.open !== void 0, l = i.closable === void 0 || i.closable === !0, u = ["tokui-canvas", "tokui-canvas--" + o];
11386
+ }), e.register("command-item", (e) => F(e)), e.register("canvas", (e, r) => {
11387
+ var i = e.attrs || {}, a = i.tt || n("canvas.title"), o = i.pos || "right", s = parseInt(i.w) || 400, c = i.open !== void 0, l = i.closable === void 0 || i.closable === !0, u = ["tokui-canvas", "tokui-canvas--" + o];
11278
11388
  c && u.push("tokui-canvas--open");
11279
11389
  var d = t("div", { class: u.join(" ") });
11280
11390
  d.style.setProperty("--tokui-canvas-w", s + "px");
@@ -11322,7 +11432,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11322
11432
  }), r._slot = r, r._tokuiType = "canvas-content", r;
11323
11433
  });
11324
11434
  }
11325
- function c(e, t) {
11435
+ function d(e, t) {
11326
11436
  var n = "1.5", r = "round", i = "round", a = "<path d=\"M6 2h8l6 6v12a2 2 0 01-2 2H6a2 2 0 01-2-2V4a2 2 0 012-2z\" fill=\"none\" stroke=\"" + t + "\" stroke-width=\"" + n + "\" stroke-linecap=\"" + r + "\" stroke-linejoin=\"" + i + "\"/><path d=\"M14 2v6h6\" fill=\"none\" stroke=\"" + t + "\" stroke-width=\"" + n + "\" stroke-linecap=\"" + r + "\" stroke-linejoin=\"" + i + "\"/>", o = {
11327
11437
  pdf: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\">" + a + "<text x=\"12\" y=\"16.5\" text-anchor=\"middle\" font-size=\"5.5\" font-weight=\"700\" font-family=\"sans-serif\" fill=\"" + t + "\">PDF</text></svg>",
11328
11438
  word: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\">" + a + "<text x=\"12\" y=\"16.5\" text-anchor=\"middle\" font-size=\"7\" font-weight=\"700\" font-family=\"sans-serif\" fill=\"" + t + "\">W</text></svg>",
@@ -11337,7 +11447,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11337
11447
  };
11338
11448
  return o[e] || o.default;
11339
11449
  }
11340
- function d(e, t) {
11450
+ function f(e, t) {
11341
11451
  if (t <= 7) {
11342
11452
  for (var n = [], r = 1; r <= t; r++) n.push(r);
11343
11453
  return n;
@@ -11347,7 +11457,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11347
11457
  for (var a = Math.max(2, e - 1), o = Math.min(t - 1, e + 1), s = a; s <= o; s++) i.push(s);
11348
11458
  return e < t - 2 && i.push("..."), i.push(t), i;
11349
11459
  }
11350
- function f() {
11460
+ function p() {
11351
11461
  typeof document > "u" || document.querySelectorAll(".tokui-dropdown__panel--open").forEach(function(e) {
11352
11462
  e.classList.remove("tokui-dropdown__panel--open"), e.style.top = "", e.style.left = "";
11353
11463
  var t = e.parentElement.querySelector(".tokui-dropdown__trigger");
@@ -11355,9 +11465,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11355
11465
  });
11356
11466
  }
11357
11467
  typeof document < "u" && typeof document.addEventListener == "function" && document.addEventListener("click", function() {
11358
- f();
11468
+ p();
11359
11469
  });
11360
- function p(e) {
11470
+ function m(e) {
11361
11471
  let t = e.querySelectorAll(".tokui-md-img");
11362
11472
  if (!t.length) return;
11363
11473
  let n = Array.from(t).map(function(e) {
@@ -11370,10 +11480,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11370
11480
  });
11371
11481
  });
11372
11482
  }
11373
- function m(e) {
11483
+ function _(e) {
11374
11484
  return typeof window < "u" && window && window[e] ? window[e] : null;
11375
11485
  }
11376
- function _(e, t) {
11486
+ function y(e, t) {
11377
11487
  var n = null;
11378
11488
  if (typeof window < "u" && window.katex && (n = window.katex), n && typeof n.renderToString == "function") try {
11379
11489
  var r = n.renderToString(e, {
@@ -11384,7 +11494,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11384
11494
  } catch {}
11385
11495
  return (t ? "$$" + e + "$$" : "$" + e + "$").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
11386
11496
  }
11387
- function v(e) {
11497
+ function b(e) {
11388
11498
  if (!e) return "";
11389
11499
  function t(e) {
11390
11500
  return e.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map(function(e) {
@@ -11399,7 +11509,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11399
11509
  function r(e) {
11400
11510
  return String(e).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
11401
11511
  }
11402
- function o(e) {
11512
+ function i(e) {
11403
11513
  return e = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), e = e.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), e = e.replace(/\*(.+?)\*/g, "<em>$1</em>"), e = e.replace(/~~(.+?)~~/g, "<del>$1</del>"), e = e.replace(/`([^`]+)`/g, "<code>$1</code>"), e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, function(e, t, n) {
11404
11514
  return /^https?:\/\//i.test(n) ? "<img src=\"" + r(n) + "\" alt=\"" + r(t) + "\" class=\"tokui-md-img\" />" : e;
11405
11515
  }), e = e.replace(/\[([^\]]+)\]\(([^)]+)\)/g, function(e, t, n) {
@@ -11429,7 +11539,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11429
11539
  }), "TOKUIMATH" + n + "";
11430
11540
  });
11431
11541
  function l(e) {
11432
- return _(e.tex, e.display);
11542
+ return y(e.tex, e.display);
11433
11543
  }
11434
11544
  function u(e) {
11435
11545
  return e.replace(/\x02TOKUIMATH(\d+)\x03/g, function(e, t) {
@@ -11442,12 +11552,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11442
11552
  if (r) {
11443
11553
  var d = s[parseInt(r[1])], f = d.lang || "text";
11444
11554
  if (f === "mermaid") return "<div class=\"tokui-md__mermaid\"><pre class=\"tokui-code\"><code class=\"language-mermaid\">" + d.code.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</code></pre></div>";
11445
- var p = i[f] ? a(d.code, f) : d.code.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
11555
+ var p = a[f] ? o(d.code, f) : d.code.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
11446
11556
  return "<pre class=\"tokui-code\"><code class=\"language-" + f + "\">" + p + "</code></pre>";
11447
11557
  }
11448
11558
  var m = e.match(/^\x02TOKUIMATH(\d+)\x03$/);
11449
11559
  if (m && c[parseInt(m[1])].display) return l(c[parseInt(m[1])]);
11450
- e = o(e), e = u(e);
11560
+ e = i(e), e = u(e);
11451
11561
  for (var h = e.split("\n"), g = [], _ = !1, v = !1, y = !1, b = !1, x = -1, S = 0; S < h.length; S++) if (h[S].trim().indexOf("|") === 0) {
11452
11562
  x = S;
11453
11563
  break;
@@ -11505,10 +11615,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11505
11615
  }
11506
11616
  }).join("");
11507
11617
  }
11508
- typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.registerBasicComponents = s, window.TokUI._internal.resolveColor = r, window.TokUI._internal.highlightCode = a), t !== void 0 && t.exports && (t.exports = {
11509
- registerBasicComponents: s,
11510
- resolveColor: r,
11511
- highlightCode: a
11618
+ typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.registerBasicComponents = c, window.TokUI._internal.resolveColor = i, window.TokUI._internal.highlightCode = o), t !== void 0 && t.exports && (t.exports = {
11619
+ registerBasicComponents: c,
11620
+ resolveColor: i,
11621
+ highlightCode: o
11512
11622
  });
11513
11623
  })), C = /* @__PURE__ */ o(((e, t) => {
11514
11624
  var n = typeof l == "function" ? u().t : window.TokUI && window.TokUI._internal && window.TokUI._internal.t || function(e) {
@@ -16149,59 +16259,61 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
16149
16259
  }, s._streamCloseHook = function() {
16150
16260
  y();
16151
16261
  }, s._tokuiType = "scroll-area", s;
16152
- }), e.register("sidebar", (e, r) => {
16153
- var i = e.attrs || {}, a = i.w || "260", o = i.pos || "left", s = i.collapsible !== void 0, c = i.bg || "", l = i.fc || "", u = ["tokui-sidebar", "tokui-sidebar--" + o];
16154
- s && u.push("tokui-sidebar--collapsible");
16155
- var d = { class: u.join(" ") };
16156
- i.id && (d.id = i.id);
16157
- var f = t("div", d);
16158
- f.style.setProperty("--tokui-sidebar-w", a + "px"), c && f.style.setProperty("--tokui-sidebar-bg", c), l && f.style.setProperty("--tokui-sidebar-fc", l), c && f.style.setProperty("--tokui-sidebar-footer-bg", "rgba(0,0,0,0.15)"), c && f.style.setProperty("--tokui-sidebar-header-bg", "rgba(0,0,0,0.15)"), c && f.style.setProperty("--tokui-sidebar-border", "rgba(255,255,255,0.1)");
16159
- var p = [], m = [], h = [];
16160
- if ((e.children || []).forEach(function(e) {
16161
- e.type === "sidebar-content" ? p.push(e) : e.type === "sidebar-footer" ? m.push(e) : h.push(e);
16162
- }), i.tt || s) {
16163
- var g = t("div", { class: "tokui-sidebar__header" });
16164
- if (i.tt) {
16165
- var _ = t("div", { class: "tokui-sidebar__title" }, i.tt);
16166
- g.appendChild(_);
16167
- }
16168
- if (s) {
16169
- var v = t("button", {
16262
+ }), e.register("sidebar", (r, i) => {
16263
+ var a = r.attrs || {}, o = a.w || "260", s = a.pos || "left", c = a.collapsible !== void 0, l = a.bg || "", u = a.fc || "", d = ["tokui-sidebar", "tokui-sidebar--" + s];
16264
+ c && d.push("tokui-sidebar--collapsible");
16265
+ var f = { class: d.join(" ") };
16266
+ a.id && (f.id = a.id);
16267
+ var p = t("div", f);
16268
+ p.style.setProperty("--tokui-sidebar-w", o + "px"), l && p.style.setProperty("--tokui-sidebar-bg", l), u && p.style.setProperty("--tokui-sidebar-fc", u), l && p.style.setProperty("--tokui-sidebar-footer-bg", "rgba(0,0,0,0.15)"), l && p.style.setProperty("--tokui-sidebar-header-bg", "rgba(0,0,0,0.15)"), l && p.style.setProperty("--tokui-sidebar-border", "rgba(255,255,255,0.1)");
16269
+ var m = [], h = [], g = [];
16270
+ if ((r.children || []).forEach(function(e) {
16271
+ e.type === "sidebar-content" ? m.push(e) : e.type === "sidebar-footer" ? h.push(e) : g.push(e);
16272
+ }), a.tt || c) {
16273
+ var _ = t("div", { class: "tokui-sidebar__header" });
16274
+ if (a.tt) {
16275
+ var v = t("div", { class: "tokui-sidebar__title" }, a.tt);
16276
+ _.appendChild(v);
16277
+ }
16278
+ if (c) {
16279
+ var y = t("button", {
16170
16280
  class: "tokui-sidebar__toggle",
16171
16281
  "aria-label": n("sidebar.toggle"),
16172
16282
  "aria-expanded": "true",
16173
16283
  type: "button"
16174
16284
  });
16175
- v.textContent = "☰", v.addEventListener("click", function() {
16176
- f.classList.toggle("tokui-sidebar--collapsed");
16177
- var e = f.classList.contains("tokui-sidebar--collapsed");
16178
- v.setAttribute("aria-expanded", String(!e));
16179
- }), f._toggleBtn = v, g.appendChild(v);
16180
- }
16181
- f.appendChild(g);
16182
- }
16183
- var y = t("div", { class: "tokui-sidebar__content" });
16184
- if (p.forEach(function(e) {
16185
- r(e.children || []).forEach(function(e) {
16186
- e && e.nodeType && y.appendChild(e);
16285
+ y.textContent = "☰";
16286
+ var b = e.createReporter("sidebar", a, p);
16287
+ y.addEventListener("click", function() {
16288
+ p.classList.toggle("tokui-sidebar--collapsed");
16289
+ var e = p.classList.contains("tokui-sidebar--collapsed");
16290
+ y.setAttribute("aria-expanded", String(!e)), b("toggle", { collapsed: e });
16291
+ }), p._toggleBtn = y, _.appendChild(y);
16292
+ }
16293
+ p.appendChild(_);
16294
+ }
16295
+ var x = t("div", { class: "tokui-sidebar__content" });
16296
+ if (m.forEach(function(e) {
16297
+ i(e.children || []).forEach(function(e) {
16298
+ e && e.nodeType && x.appendChild(e);
16187
16299
  });
16188
- }), r(h).forEach(function(e) {
16189
- e && e.nodeType && y.appendChild(e);
16190
- }), f.appendChild(y), m.length > 0) {
16191
- var b = t("div", { class: "tokui-sidebar__footer" });
16192
- m.forEach(function(e) {
16193
- r(e.children || []).forEach(function(e) {
16194
- e && e.nodeType && b.appendChild(e);
16300
+ }), i(g).forEach(function(e) {
16301
+ e && e.nodeType && x.appendChild(e);
16302
+ }), p.appendChild(x), h.length > 0) {
16303
+ var S = t("div", { class: "tokui-sidebar__footer" });
16304
+ h.forEach(function(e) {
16305
+ i(e.children || []).forEach(function(e) {
16306
+ e && e.nodeType && S.appendChild(e);
16195
16307
  });
16196
- }), f.appendChild(b);
16308
+ }), p.appendChild(S);
16197
16309
  }
16198
- return f._slot = y, f._tokuiType = "sidebar", f._update = function(e) {
16310
+ return p._slot = x, p._tokuiType = "sidebar", p._update = function(e) {
16199
16311
  if (e.tt !== void 0) {
16200
- var t = f.querySelector(".tokui-sidebar__title");
16312
+ var t = p.querySelector(".tokui-sidebar__title");
16201
16313
  t && (t.textContent = e.tt);
16202
16314
  }
16203
- e.act === "collapse" ? f.classList.add("tokui-sidebar--collapsed") : e.act === "expand" ? f.classList.remove("tokui-sidebar--collapsed") : e.act === "toggle" && f.classList.toggle("tokui-sidebar--collapsed"), e.act && f._toggleBtn && f._toggleBtn.setAttribute("aria-expanded", String(!f.classList.contains("tokui-sidebar--collapsed")));
16204
- }, e._dsl !== void 0 && (f._dslNode = e), f;
16315
+ e.act === "collapse" ? p.classList.add("tokui-sidebar--collapsed") : e.act === "expand" ? p.classList.remove("tokui-sidebar--collapsed") : e.act === "toggle" && p.classList.toggle("tokui-sidebar--collapsed"), e.act && p._toggleBtn && p._toggleBtn.setAttribute("aria-expanded", String(!p.classList.contains("tokui-sidebar--collapsed")));
16316
+ }, r._dsl !== void 0 && (p._dslNode = r), p;
16205
16317
  }), e.register("sidebar-content", (e, n) => {
16206
16318
  var r = t("div", { class: "tokui-sidebar__content" });
16207
16319
  return n(e.children || []).forEach(function(e) {
@@ -16244,8 +16356,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
16244
16356
  theme: "default",
16245
16357
  locale: null,
16246
16358
  streaming: !0,
16359
+ streamAnimation: !0,
16247
16360
  onEvent: null
16248
- }, e), this.renderer = new n(i), s(this.renderer), this.renderer._tokuiInstance = this;
16361
+ }, e), this.renderer = new n(i), s(this.renderer), this.renderer.streamAnimation = this.options.streamAnimation !== !1, this.renderer._tokuiInstance = this;
16249
16362
  var t = this;
16250
16363
  this.renderer._onComponentEvent = function(e) {
16251
16364
  t.options.eventFilter && !t.options.eventFilter(e) || t.options.onEvent && t.options.onEvent("component", e);