@infotrust/ui 0.0.0-stage → 0.30.1
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/LICENSE +24 -0
- package/NOTICE.md +37 -0
- package/README.md +53 -2
- package/dist/assistant-session-DP4_70Xk.js +1381 -0
- package/dist/command-Bjncx7YR.js +1279 -0
- package/dist/components/actions/ItActionMenu.vue.d.ts +24 -0
- package/dist/components/actions/ItDecisionToggle.vue.d.ts +22 -0
- package/dist/components/actions/ItIconButton.vue.d.ts +24 -0
- package/dist/components/actions/ItLinkButton.vue.d.ts +17 -0
- package/dist/components/actions/action-menu.d.ts +19 -0
- package/dist/components/charts/ItBarChart.vue.d.ts +121 -0
- package/dist/components/charts/ItCalendarChart.vue.d.ts +80 -0
- package/dist/components/charts/ItChartLegend.vue.d.ts +47 -0
- package/dist/components/charts/ItChartTable.vue.d.ts +16 -0
- package/dist/components/charts/ItChartTooltip.vue.d.ts +52 -0
- package/dist/components/charts/ItDonutChart.vue.d.ts +79 -0
- package/dist/components/charts/ItProportionBar.vue.d.ts +42 -0
- package/dist/components/charts/ItSparkline.vue.d.ts +42 -0
- package/dist/components/charts/ItTrendChart.vue.d.ts +80 -0
- package/dist/components/charts/chart.d.ts +84 -0
- package/dist/components/charts/selection.d.ts +14 -0
- package/dist/components/charts/skeleton.d.ts +16 -0
- package/dist/components/command/ItAssistantPanel.vue.d.ts +56 -0
- package/dist/components/command/ItAssistantThread.vue.d.ts +73 -0
- package/dist/components/command/ItCommandPalette.vue.d.ts +102 -0
- package/dist/components/command/ItMarkdown.vue.d.ts +12 -0
- package/dist/components/command/assistant-session.d.ts +26 -0
- package/dist/components/command/command.d.ts +127 -0
- package/dist/components/command/markdown.d.ts +55 -0
- package/dist/components/content/ItDocsArticle.vue.d.ts +18 -0
- package/dist/components/content/ItDocsLayout.vue.d.ts +29 -0
- package/dist/components/content/ItDocsPager.vue.d.ts +12 -0
- package/dist/components/content/ItProse.vue.d.ts +18 -0
- package/dist/components/content/docs.d.ts +23 -0
- package/dist/components/dag/ItDagCanvas.vue.d.ts +143 -0
- package/dist/components/dag/ItDagControls.vue.d.ts +2 -0
- package/dist/components/dag/ItDagEdge.vue.d.ts +21 -0
- package/dist/components/dag/ItDagLibrary.vue.d.ts +19 -0
- package/dist/components/dag/ItDagNode.vue.d.ts +20 -0
- package/dist/components/dag/dag.d.ts +182 -0
- package/dist/components/dag/history.d.ts +51 -0
- package/dist/components/dag/layout.d.ts +54 -0
- package/dist/components/dag/route.d.ts +24 -0
- package/dist/components/data/DataError.vue.d.ts +12 -0
- package/dist/components/data/ItChangeList.vue.d.ts +48 -0
- package/dist/components/data/ItCodeBlock.vue.d.ts +23 -0
- package/dist/components/data/ItDataTable.vue.d.ts +135 -0
- package/dist/components/data/ItDataToolbar.vue.d.ts +57 -0
- package/dist/components/data/ItDescriptionList.vue.d.ts +30 -0
- package/dist/components/data/ItEmptyState.vue.d.ts +22 -0
- package/dist/components/data/ItKpiCard.vue.d.ts +89 -0
- package/dist/components/data/ItKpiDetail.vue.d.ts +40 -0
- package/dist/components/data/ItKpiGrid.vue.d.ts +19 -0
- package/dist/components/data/ItObjectName.vue.d.ts +64 -0
- package/dist/components/data/ItPaginator.vue.d.ts +46 -0
- package/dist/components/data/ItResourceList.vue.d.ts +39 -0
- package/dist/components/data/ItResourceListItem.vue.d.ts +40 -0
- package/dist/components/data/ItSkeleton.vue.d.ts +14 -0
- package/dist/components/data/ItTablePaginator.vue.d.ts +34 -0
- package/dist/components/data/ItTime.vue.d.ts +13 -0
- package/dist/components/data/ItTreeTable.vue.d.ts +109 -0
- package/dist/components/data/TableChevron.vue.d.ts +8 -0
- package/dist/components/data/TableExpansion.vue.d.ts +22 -0
- package/dist/components/data/column-sizing.d.ts +31 -0
- package/dist/components/data/data-table.d.ts +15 -0
- package/dist/components/data/highlight-worker.d.ts +1 -0
- package/dist/components/data/highlight.d.ts +3 -0
- package/dist/components/data/kpi-placement.d.ts +40 -0
- package/dist/components/data/kpi.d.ts +16 -0
- package/dist/components/data/sticky-header.d.ts +9 -0
- package/dist/components/data/table-skeleton.d.ts +11 -0
- package/dist/components/data/table-source.d.ts +77 -0
- package/dist/components/data/tree-table-public.d.ts +17 -0
- package/dist/components/data/tree-table.d.ts +30 -0
- package/dist/components/feedback/ItCallout.vue.d.ts +25 -0
- package/dist/components/feedback/ItConfirmHost.vue.d.ts +2 -0
- package/dist/components/feedback/ItOverlayHost.vue.d.ts +2 -0
- package/dist/components/feedback/ItProgressBar.vue.d.ts +19 -0
- package/dist/components/feedback/ItToastHost.vue.d.ts +2 -0
- package/dist/components/forms/FieldClearButton.vue.d.ts +11 -0
- package/dist/components/forms/ItAutoComplete.vue.d.ts +69 -0
- package/dist/components/forms/ItCheckboxGroup.vue.d.ts +27 -0
- package/dist/components/forms/ItChipInput.vue.d.ts +32 -0
- package/dist/components/forms/ItCodeEditor.vue.d.ts +64 -0
- package/dist/components/forms/ItDatePicker.vue.d.ts +35 -0
- package/dist/components/forms/ItFileDrop.vue.d.ts +47 -0
- package/dist/components/forms/ItFilterChip.vue.d.ts +13 -0
- package/dist/components/forms/ItFilterMenu.vue.d.ts +37 -0
- package/dist/components/forms/ItFilterPopover.vue.d.ts +44 -0
- package/dist/components/forms/ItFormActions.vue.d.ts +14 -0
- package/dist/components/forms/ItFormField.vue.d.ts +44 -0
- package/dist/components/forms/ItFormRows.vue.d.ts +50 -0
- package/dist/components/forms/ItFormSection.vue.d.ts +28 -0
- package/dist/components/forms/ItLabelCell.vue.d.ts +42 -0
- package/dist/components/forms/ItLabelPicker.vue.d.ts +34 -0
- package/dist/components/forms/ItMultiSelect.vue.d.ts +53 -0
- package/dist/components/forms/ItOptionCardGroup.vue.d.ts +35 -0
- package/dist/components/forms/ItRadioGroup.vue.d.ts +29 -0
- package/dist/components/forms/ItSearchInput.vue.d.ts +25 -0
- package/dist/components/forms/ItSegmentedControl.vue.d.ts +25 -0
- package/dist/components/forms/ItSelect.vue.d.ts +50 -0
- package/dist/components/forms/ItSwitch.vue.d.ts +31 -0
- package/dist/components/forms/ItTabs.vue.d.ts +27 -0
- package/dist/components/forms/OptionSourceSlot.vue.d.ts +13 -0
- package/dist/components/forms/choice.d.ts +24 -0
- package/dist/components/forms/code-editor.d.ts +17 -0
- package/dist/components/forms/field-context.d.ts +39 -0
- package/dist/components/forms/file-drop.d.ts +19 -0
- package/dist/components/forms/form-errors.d.ts +7 -0
- package/dist/components/forms/form-rows.d.ts +8 -0
- package/dist/components/forms/option-source.d.ts +39 -0
- package/dist/components/forms/virtual-options.d.ts +12 -0
- package/dist/components/layout/ItBreadcrumb.vue.d.ts +12 -0
- package/dist/components/layout/ItDetailSection.vue.d.ts +21 -0
- package/dist/components/layout/ItPage.vue.d.ts +44 -0
- package/dist/components/layout/ItPanel.vue.d.ts +47 -0
- package/dist/components/layout/ItSectionNav.vue.d.ts +43 -0
- package/dist/components/layout/ItWizard.vue.d.ts +57 -0
- package/dist/components/layout/ItWizardSteps.vue.d.ts +15 -0
- package/dist/components/layout/SectionNavLinks.vue.d.ts +15 -0
- package/dist/components/layout/panel.d.ts +18 -0
- package/dist/components/layout/section-nav.d.ts +17 -0
- package/dist/components/layout/wizard.d.ts +13 -0
- package/dist/components/logic/ItFieldPicker.vue.d.ts +40 -0
- package/dist/components/logic/ItLogicBuilder.vue.d.ts +58 -0
- package/dist/components/logic/ItLogicCondition.vue.d.ts +9 -0
- package/dist/components/logic/ItLogicGroup.vue.d.ts +9 -0
- package/dist/components/logic/ItOperatorSelect.vue.d.ts +25 -0
- package/dist/components/logic/ItValueInput.vue.d.ts +29 -0
- package/dist/components/logic/logic.d.ts +263 -0
- package/dist/components/logic/region.d.ts +44 -0
- package/dist/components/overlays/ItDrawer.vue.d.ts +48 -0
- package/dist/components/overlays/ItModal.vue.d.ts +53 -0
- package/dist/components/overlays/escape-stack.d.ts +7 -0
- package/dist/components/overlays/modal.d.ts +23 -0
- package/dist/components/shell/ItAppShell.vue.d.ts +68 -0
- package/dist/components/shell/ItCommandTrigger.vue.d.ts +17 -0
- package/dist/components/shell/ItOrgSwitcher.vue.d.ts +26 -0
- package/dist/components/shell/ItShellMenuItem.vue.d.ts +18 -0
- package/dist/components/shell/ItShellNavBranch.vue.d.ts +15 -0
- package/dist/components/shell/ItShellNavLink.vue.d.ts +18 -0
- package/dist/components/shell/ItShellSidebarButton.vue.d.ts +15 -0
- package/dist/components/shell/ItThemeControl.vue.d.ts +13 -0
- package/dist/components/shell/org.d.ts +36 -0
- package/dist/components/shell/types.d.ts +67 -0
- package/dist/components/status/ItBadge.vue.d.ts +12 -0
- package/dist/components/status/ItEntityTypeChip.vue.d.ts +14 -0
- package/dist/components/status/ItLabelChip.vue.d.ts +21 -0
- package/dist/components/status/ItLabelChipList.vue.d.ts +27 -0
- package/dist/components/status/ItPlatformChip.vue.d.ts +20 -0
- package/dist/components/status/ItPlatformLogo.vue.d.ts +17 -0
- package/dist/components/status/ItSeverityBadge.vue.d.ts +9 -0
- package/dist/components/status/ItStatus.vue.d.ts +12 -0
- package/dist/components.css +1 -0
- package/dist/composables/iconMotion.d.ts +12 -0
- package/dist/composables/ripple.d.ts +3 -0
- package/dist/composables/useItConfirm.d.ts +16 -0
- package/dist/composables/useItCopy.d.ts +4 -0
- package/dist/composables/useItCursorPager.d.ts +50 -0
- package/dist/composables/useItTheme.d.ts +26 -0
- package/dist/composables/useItToast.d.ts +24 -0
- package/dist/dag.d.ts +5 -0
- package/dist/dag.js +1754 -0
- package/dist/dev-D7A7MIn_.js +1264 -0
- package/dist/directives/truncate.d.ts +29 -0
- package/dist/elk-worker.min-O2A22ecl.js +6321 -0
- package/dist/format/index.d.ts +53 -0
- package/dist/highlight-worker-DIrLC7a2.js +25 -0
- package/dist/index.d.ts +147 -0
- package/dist/index.js +11989 -0
- package/dist/licenses/@vue-flow__core.LICENSE +20 -0
- package/dist/licenses/elkjs.LICENSE.md +263 -0
- package/dist/licenses/highlight.js.LICENSE +29 -0
- package/dist/licenses/vue-sonner.LICENSE +21 -0
- package/dist/platform-art-Bt1CnaKE.js +86 -0
- package/dist/plugin.d.ts +69 -0
- package/dist/registries/entity-type.d.ts +18 -0
- package/dist/registries/platform-art.d.ts +2 -0
- package/dist/registries/platform-marks.d.ts +12 -0
- package/dist/registries/platform.d.ts +22 -0
- package/dist/registries/severity.d.ts +23 -0
- package/dist/registries/status.d.ts +13 -0
- package/dist/styles.css +26 -0
- package/dist/text-nGkJYA88.js +470 -0
- package/dist/utils/chip-truncation.d.ts +8 -0
- package/dist/utils/chunk-recovery.d.ts +24 -0
- package/dist/utils/dev.d.ts +2 -0
- package/dist/utils/listeners.d.ts +10 -0
- package/dist/utils/router.d.ts +9 -0
- package/dist/utils/scroll.d.ts +8 -0
- package/dist/utils/select.d.ts +21 -0
- package/dist/utils/text.d.ts +6 -0
- package/package.json +91 -3
|
@@ -0,0 +1,1279 @@
|
|
|
1
|
+
import { defineComponent as ye, computed as T, ref as M, watch as ee, onMounted as Ze, onBeforeUnmount as qe, openBlock as o, createElementBlock as f, normalizeClass as Te, createElementVNode as p, normalizeStyle as kt, createBlock as N, unref as b, createCommentVNode as S, toDisplayString as C, withCtx as U, Fragment as L, renderList as ne, h as B, inject as gt, nextTick as G, createTextVNode as D, createVNode as z, renderSlot as V, withModifiers as bt, useSlots as _t, useId as wt, getCurrentInstance as $t, provide as et, withDirectives as Ct, vModelText as St, resolveDynamicComponent as Tt, normalizeProps as ae, guardReactiveProps as se, createSlots as tt } from "vue";
|
|
2
|
+
import xt from "primevue/dialog";
|
|
3
|
+
import me from "primevue/button";
|
|
4
|
+
import { u as Lt, _ as At, I as Re, a as at, i as It, c as jt, b as Bt, s as Mt } from "./assistant-session-DP4_70Xk.js";
|
|
5
|
+
import { Check as Et, Copy as zt, LoaderCircle as st, CircleCheck as qt, CircleAlert as Rt, Square as Pt, Send as Dt, Search as Nt, Sparkles as Me, ArrowLeft as Qe, X as ze, RotateCcw as lt } from "lucide-vue-next";
|
|
6
|
+
import { _ as le, i as Ht, u as Kt, a as Ot } from "./text-nGkJYA88.js";
|
|
7
|
+
import Wt from "primevue/textarea";
|
|
8
|
+
import Ut from "highlight.js/lib/core";
|
|
9
|
+
import Vt from "highlight.js/lib/languages/bash";
|
|
10
|
+
import Ft from "highlight.js/lib/languages/css";
|
|
11
|
+
import Gt from "highlight.js/lib/languages/javascript";
|
|
12
|
+
import Jt from "highlight.js/lib/languages/json";
|
|
13
|
+
import Qt from "highlight.js/lib/languages/sql";
|
|
14
|
+
import Xt from "highlight.js/lib/languages/typescript";
|
|
15
|
+
import Yt from "highlight.js/lib/languages/xml";
|
|
16
|
+
import Zt from "highlight.js/lib/languages/yaml";
|
|
17
|
+
let F;
|
|
18
|
+
function ea() {
|
|
19
|
+
return F || (F = Ut.newInstance(), F.registerLanguage("json", Jt), F.registerLanguage("yaml", Zt), F.registerLanguage("javascript", Gt), F.registerLanguage("typescript", Xt), F.registerLanguage("html", Yt), F.registerLanguage("css", Ft), F.registerLanguage("sql", Qt), F.registerLanguage("bash", Vt), F);
|
|
20
|
+
}
|
|
21
|
+
function ta(t) {
|
|
22
|
+
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
23
|
+
}
|
|
24
|
+
function Ee(t, h) {
|
|
25
|
+
return h === "text" ? ta(t) : ea().highlight(t, { language: h, ignoreIllegals: !0 }).value;
|
|
26
|
+
}
|
|
27
|
+
const aa = ["aria-label"], sa = ["data-language", "innerHTML"], la = {
|
|
28
|
+
key: 1,
|
|
29
|
+
class: "it-sr-only",
|
|
30
|
+
"aria-live": "polite"
|
|
31
|
+
}, ia = 3e4, na = 8e3, oa = 200, ra = /* @__PURE__ */ ye({
|
|
32
|
+
__name: "ItCodeBlock",
|
|
33
|
+
props: {
|
|
34
|
+
code: { default: void 0 },
|
|
35
|
+
value: { default: void 0 },
|
|
36
|
+
language: { default: void 0 },
|
|
37
|
+
label: {},
|
|
38
|
+
maxLines: { default: 18 },
|
|
39
|
+
copyable: { type: Boolean, default: !0 }
|
|
40
|
+
},
|
|
41
|
+
setup(t) {
|
|
42
|
+
const h = t, _ = T(() => h.code ?? (h.value === void 0 ? "" : JSON.stringify(h.value, null, 2))), n = T(() => h.language ?? (h.code === void 0 && h.value !== void 0 ? "json" : "text")), l = T(() => ({ "--it-code-block-lines": String(h.maxLines) })), m = M("");
|
|
43
|
+
let g = !1, y = !1, i;
|
|
44
|
+
function r(I, $, q) {
|
|
45
|
+
let P = -1;
|
|
46
|
+
for (let K = 0; K < q; K++) {
|
|
47
|
+
const J = I.indexOf(`
|
|
48
|
+
`, P + 1);
|
|
49
|
+
if (J === -1 || J >= na) break;
|
|
50
|
+
P = J;
|
|
51
|
+
}
|
|
52
|
+
return Ee(I.slice(0, P + 1), $) + Ee(I.slice(P + 1), "text");
|
|
53
|
+
}
|
|
54
|
+
function u(I, $) {
|
|
55
|
+
let q;
|
|
56
|
+
const P = setTimeout(() => {
|
|
57
|
+
typeof requestIdleCallback == "function" ? q = requestIdleCallback(I, { timeout: 1e3 }) : I();
|
|
58
|
+
}, $);
|
|
59
|
+
return () => {
|
|
60
|
+
clearTimeout(P), q !== void 0 && cancelIdleCallback(q);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function d(I) {
|
|
64
|
+
i = u(async () => {
|
|
65
|
+
let $, q = !0;
|
|
66
|
+
const P = () => {
|
|
67
|
+
q = !1, $ == null || $.terminate();
|
|
68
|
+
};
|
|
69
|
+
i = P;
|
|
70
|
+
try {
|
|
71
|
+
const { default: K } = await import("./highlight-worker-DIrLC7a2.js");
|
|
72
|
+
if (!q) return;
|
|
73
|
+
$ = new K();
|
|
74
|
+
} catch {
|
|
75
|
+
q && (i = void 0);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
$.onerror = () => {
|
|
79
|
+
q && (P(), i = void 0);
|
|
80
|
+
}, $.onmessage = (K) => {
|
|
81
|
+
if (!q) return;
|
|
82
|
+
if (P(), typeof K.data.html != "string") {
|
|
83
|
+
i = void 0;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const J = K.data.html;
|
|
87
|
+
i = u(() => {
|
|
88
|
+
i = void 0, g = !1, m.value = J;
|
|
89
|
+
}, 0);
|
|
90
|
+
};
|
|
91
|
+
try {
|
|
92
|
+
$.postMessage({ code: _.value, language: n.value });
|
|
93
|
+
} catch {
|
|
94
|
+
P(), i = void 0;
|
|
95
|
+
}
|
|
96
|
+
}, I);
|
|
97
|
+
}
|
|
98
|
+
ee(
|
|
99
|
+
[_, n],
|
|
100
|
+
([I, $]) => {
|
|
101
|
+
i == null || i(), i = void 0, g = $ !== "text" && I.length > ia, m.value = g ? r(I, $, h.maxLines * 2) : Ee(I, $), g && y && d(oa);
|
|
102
|
+
},
|
|
103
|
+
{ immediate: !0 }
|
|
104
|
+
), Ze(() => {
|
|
105
|
+
y = !0, g && d(0);
|
|
106
|
+
});
|
|
107
|
+
const A = M(!1), { copy: H } = Lt();
|
|
108
|
+
let E;
|
|
109
|
+
async function j() {
|
|
110
|
+
await H(_.value) && (A.value = !0, clearTimeout(E), E = setTimeout(() => A.value = !1, 1500));
|
|
111
|
+
}
|
|
112
|
+
return qe(() => {
|
|
113
|
+
clearTimeout(E), i == null || i();
|
|
114
|
+
}), (I, $) => (o(), f("div", {
|
|
115
|
+
class: Te(["it-code-block", { "it-code-block--copyable": t.copyable }])
|
|
116
|
+
}, [
|
|
117
|
+
p("pre", {
|
|
118
|
+
class: "it-code-block__pre",
|
|
119
|
+
role: "region",
|
|
120
|
+
tabindex: "0",
|
|
121
|
+
"aria-label": t.label,
|
|
122
|
+
style: kt(l.value)
|
|
123
|
+
}, [
|
|
124
|
+
p("code", {
|
|
125
|
+
"data-language": n.value,
|
|
126
|
+
innerHTML: m.value
|
|
127
|
+
}, null, 8, sa)
|
|
128
|
+
], 12, aa),
|
|
129
|
+
t.copyable ? (o(), N(le, {
|
|
130
|
+
key: 0,
|
|
131
|
+
class: "it-code-block__copy",
|
|
132
|
+
icon: A.value ? b(Et) : b(zt),
|
|
133
|
+
label: A.value ? "Copied" : `Copy ${b(Ht)(t.label)}`,
|
|
134
|
+
size: "sm",
|
|
135
|
+
onClick: j
|
|
136
|
+
}, null, 8, ["icon", "label"])) : S("", !0),
|
|
137
|
+
t.copyable ? (o(), f("span", la, C(A.value ? "Copied" : ""), 1)) : S("", !0)
|
|
138
|
+
], 2));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
function ua(t) {
|
|
142
|
+
if (/[\\\u0000-\u001f\u007f]/.test(t)) return null;
|
|
143
|
+
const h = t.trim();
|
|
144
|
+
return /^(https?:|mailto:)/i.test(h) || /^\/(?![/\\])/.test(h) || h.startsWith("#") || h.startsWith("?") ? h : null;
|
|
145
|
+
}
|
|
146
|
+
function ie(t) {
|
|
147
|
+
const h = [];
|
|
148
|
+
let _ = "";
|
|
149
|
+
const n = () => {
|
|
150
|
+
_ && h.push({ type: "text", text: _ }), _ = "";
|
|
151
|
+
};
|
|
152
|
+
let l = 0;
|
|
153
|
+
for (; l < t.length; ) {
|
|
154
|
+
const m = t.slice(l), g = /^`([^`]+)`/.exec(m);
|
|
155
|
+
if (g) {
|
|
156
|
+
n(), h.push({ type: "code", text: g[1] }), l += g[0].length;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const y = /^\[([^\]]+)\]\(([^)\s]+)\)/.exec(m);
|
|
160
|
+
if (y) {
|
|
161
|
+
const u = ua(y[2]);
|
|
162
|
+
n(), u ? h.push({ type: "link", href: u, children: ie(y[1]) }) : h.push(...ie(y[1])), l += y[0].length;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const i = /^(\*\*|__)(?=\S)([\s\S]*?\S)\1/.exec(m);
|
|
166
|
+
if (i) {
|
|
167
|
+
n(), h.push({ type: "strong", children: ie(i[2]) }), l += i[0].length;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const r = /^(\*|_)(?=\S)([\s\S]*?\S)\1(?![*_])/.exec(m);
|
|
171
|
+
if (r && !(r[1] === "_" && /\w/.test(t[l - 1] ?? ""))) {
|
|
172
|
+
n(), h.push({ type: "em", children: ie(r[2]) }), l += r[0].length;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
_ += t[l], l += 1;
|
|
176
|
+
}
|
|
177
|
+
return n(), h;
|
|
178
|
+
}
|
|
179
|
+
const Xe = (t) => t.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((h) => ie(h.trim())), Ye = (t) => !!t && /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/.test(t), Se = /^\s*([-*+]|\d+[.)])\s+(.*)$/;
|
|
180
|
+
function ca(t) {
|
|
181
|
+
return it(t.replace(/\r\n?/g, `
|
|
182
|
+
`).split(`
|
|
183
|
+
`), 0).blocks;
|
|
184
|
+
}
|
|
185
|
+
function it(t, h) {
|
|
186
|
+
const _ = [], n = [];
|
|
187
|
+
let l = h;
|
|
188
|
+
for (; l < t.length; ) {
|
|
189
|
+
const m = t[l];
|
|
190
|
+
if (m.trim() && n.push(l), !m.trim()) {
|
|
191
|
+
l += 1;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const g = /^\s*(```|~~~)\s*([\w+-]*)/.exec(m);
|
|
195
|
+
if (g) {
|
|
196
|
+
const u = [];
|
|
197
|
+
l += 1;
|
|
198
|
+
let d = !1;
|
|
199
|
+
for (; l < t.length; ) {
|
|
200
|
+
if (t[l].trim().startsWith(g[1])) {
|
|
201
|
+
d = !0, l += 1;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
u.push(t[l]), l += 1;
|
|
205
|
+
}
|
|
206
|
+
_.push({ type: "code", language: g[2].toLowerCase(), code: u.join(`
|
|
207
|
+
`), closed: d });
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const y = /^(#{1,6})\s+(.*)$/.exec(m);
|
|
211
|
+
if (y) {
|
|
212
|
+
_.push({ type: "heading", level: Math.min(4, y[1].length), children: ie(y[2].replace(/\s+#+\s*$/, "")) }), l += 1;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(m)) {
|
|
216
|
+
_.push({ type: "rule" }), l += 1;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (/^\s*>/.test(m)) {
|
|
220
|
+
const u = [];
|
|
221
|
+
for (; l < t.length && /^\s*>/.test(t[l]); ) u.push(t[l++].replace(/^\s*>\s?/, ""));
|
|
222
|
+
_.push({ type: "quote", children: ca(u.join(`
|
|
223
|
+
`)) });
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (m.includes("|") && Ye(t[l + 1])) {
|
|
227
|
+
const u = Xe(m);
|
|
228
|
+
l += 2;
|
|
229
|
+
const d = [];
|
|
230
|
+
for (; l < t.length && t[l].includes("|") && t[l].trim(); ) d.push(Xe(t[l++]));
|
|
231
|
+
_.push({ type: "table", head: u, rows: d });
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
const i = Se.exec(m);
|
|
235
|
+
if (i) {
|
|
236
|
+
const u = /\d/.test(i[1]), d = [], A = u ? parseInt(i[1], 10) : 1;
|
|
237
|
+
for (; l < t.length; ) {
|
|
238
|
+
const H = Se.exec(t[l]);
|
|
239
|
+
if (H && /\d/.test(H[1]) === u) {
|
|
240
|
+
let E = H[2];
|
|
241
|
+
for (l += 1; l < t.length && /^\s{2,}\S/.test(t[l]) && !Se.test(t[l]); ) E += ` ${t[l++].trim()}`;
|
|
242
|
+
d.push(ie(E));
|
|
243
|
+
} else break;
|
|
244
|
+
}
|
|
245
|
+
_.push({ type: "list", ordered: u, start: A, items: d });
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const r = [];
|
|
249
|
+
for (; l < t.length && t[l].trim() && !/^\s*(```|~~~|#{1,6}\s|>)/.test(t[l]) && !Se.test(t[l]) && !(t[l].includes("|") && Ye(t[l + 1])); )
|
|
250
|
+
r.push(t[l++].trim());
|
|
251
|
+
_.push({ type: "paragraph", children: ie(r.join(" ")) });
|
|
252
|
+
}
|
|
253
|
+
return { blocks: _, starts: n };
|
|
254
|
+
}
|
|
255
|
+
function da() {
|
|
256
|
+
let t = null;
|
|
257
|
+
return (h) => {
|
|
258
|
+
const _ = h.replace(/\r\n?/g, `
|
|
259
|
+
`), n = _.split(`
|
|
260
|
+
`);
|
|
261
|
+
let l = 0;
|
|
262
|
+
if (t && _.startsWith(t.source)) {
|
|
263
|
+
const r = t.lines - 1;
|
|
264
|
+
for (; l < t.starts.length && t.starts[l] + 2 <= r; ) l += 1;
|
|
265
|
+
l = Math.max(0, l - 1);
|
|
266
|
+
}
|
|
267
|
+
const m = t && l > 0 ? t.starts[l] : 0, g = it(n, m), y = l > 0 ? [...t.blocks.slice(0, l), ...g.blocks] : g.blocks, i = l > 0 ? [...t.starts.slice(0, l), ...g.starts] : g.starts;
|
|
268
|
+
return t = { source: _, lines: n.length, blocks: y, starts: i }, y;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
const va = /* @__PURE__ */ ye({
|
|
272
|
+
__name: "ItMarkdown",
|
|
273
|
+
props: {
|
|
274
|
+
source: {},
|
|
275
|
+
streaming: { type: Boolean, default: !1 },
|
|
276
|
+
navigate: { type: Function, default: void 0 }
|
|
277
|
+
},
|
|
278
|
+
setup(t) {
|
|
279
|
+
const h = t, _ = da(), n = T(() => _(h.source)), l = {
|
|
280
|
+
json: "json",
|
|
281
|
+
yaml: "yaml",
|
|
282
|
+
yml: "yaml",
|
|
283
|
+
js: "javascript",
|
|
284
|
+
javascript: "javascript",
|
|
285
|
+
ts: "typescript",
|
|
286
|
+
typescript: "typescript",
|
|
287
|
+
html: "html",
|
|
288
|
+
xml: "html",
|
|
289
|
+
css: "css",
|
|
290
|
+
sql: "sql",
|
|
291
|
+
bash: "bash",
|
|
292
|
+
sh: "bash",
|
|
293
|
+
shell: "bash"
|
|
294
|
+
};
|
|
295
|
+
function m(i) {
|
|
296
|
+
return i.map((r) => {
|
|
297
|
+
if (r.type === "text") return r.text;
|
|
298
|
+
if (r.type === "code") return B("code", { class: "it-md__code" }, r.text);
|
|
299
|
+
if (r.type === "strong" || r.type === "em") return B(r.type, m(r.children));
|
|
300
|
+
const u = /^(\/(?![/\\])|#|\?)/.test(r.href);
|
|
301
|
+
return B(
|
|
302
|
+
"a",
|
|
303
|
+
{
|
|
304
|
+
href: r.href,
|
|
305
|
+
class: "it-md__link",
|
|
306
|
+
...u ? {} : { target: "_blank", rel: "noopener noreferrer" },
|
|
307
|
+
onClick: (d) => {
|
|
308
|
+
!u || !h.navigate || d.metaKey || d.ctrlKey || d.shiftKey || d.button !== 0 || (d.preventDefault(), h.navigate(r.href));
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
m(r.children)
|
|
312
|
+
);
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function g(i, r) {
|
|
316
|
+
switch (i.type) {
|
|
317
|
+
case "heading":
|
|
318
|
+
return B(`h${i.level + 2 > 6 ? 6 : i.level + 2}`, { key: r, class: `it-md__heading it-md__heading--${i.level}` }, m(i.children));
|
|
319
|
+
case "paragraph":
|
|
320
|
+
return B("p", { key: r }, m(i.children));
|
|
321
|
+
case "list":
|
|
322
|
+
return B(i.ordered ? "ol" : "ul", { key: r, start: i.ordered && i.start !== 1 ? i.start : void 0 }, i.items.map((u, d) => B("li", { key: d }, m(u))));
|
|
323
|
+
case "quote":
|
|
324
|
+
return B("blockquote", { key: r }, i.children.map(g));
|
|
325
|
+
case "rule":
|
|
326
|
+
return B("hr", { key: r });
|
|
327
|
+
case "table":
|
|
328
|
+
return B("div", { key: r, class: "it-md__table" }, [
|
|
329
|
+
B("table", [
|
|
330
|
+
B("thead", [B("tr", i.head.map((u, d) => B("th", { key: d }, m(u))))]),
|
|
331
|
+
B("tbody", i.rows.map((u, d) => B("tr", { key: d }, u.map((A, H) => B("td", { key: H }, m(A))))))
|
|
332
|
+
])
|
|
333
|
+
]);
|
|
334
|
+
case "code":
|
|
335
|
+
return h.streaming || !i.closed ? B("pre", { key: r, class: "it-md__pre" }, B("code", i.code)) : B(ra, { key: r, class: "it-prose-exclude", code: i.code, language: l[i.language] ?? "text", label: i.language ? `${i.language.toUpperCase()} code` : "Code", maxLines: 24 });
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
const y = ye({
|
|
339
|
+
props: { node: { type: Object, required: !0 }, index: { type: Number, required: !0 } },
|
|
340
|
+
setup: (i) => () => g(i.node, i.index)
|
|
341
|
+
});
|
|
342
|
+
return (i, r) => (o(), N(At, { class: "it-md" }, {
|
|
343
|
+
default: U(() => [
|
|
344
|
+
(o(!0), f(L, null, ne(n.value, (u, d) => (o(), N(b(y), {
|
|
345
|
+
key: d,
|
|
346
|
+
node: u,
|
|
347
|
+
index: d
|
|
348
|
+
}, null, 8, ["node", "index"]))), 128))
|
|
349
|
+
]),
|
|
350
|
+
_: 1
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
}), fa = { class: "it-thread" }, ha = {
|
|
354
|
+
key: 0,
|
|
355
|
+
class: "it-thread__bubble it-thread__bubble--user"
|
|
356
|
+
}, pa = {
|
|
357
|
+
key: 0,
|
|
358
|
+
class: "it-thread__tools",
|
|
359
|
+
"aria-label": "Steps"
|
|
360
|
+
}, ma = { class: "it-thread__tool-text" }, ya = { class: "it-sr-only" }, ka = {
|
|
361
|
+
key: 0,
|
|
362
|
+
class: "it-thread__tool-detail"
|
|
363
|
+
}, ga = {
|
|
364
|
+
key: 1,
|
|
365
|
+
class: "it-thread__bubble it-thread__bubble--assistant"
|
|
366
|
+
}, ba = {
|
|
367
|
+
key: 2,
|
|
368
|
+
class: "it-thread__stopped"
|
|
369
|
+
}, _a = { class: "it-thread__action" }, wa = { class: "it-thread__action-title" }, $a = {
|
|
370
|
+
key: 0,
|
|
371
|
+
class: "it-thread__action-reason"
|
|
372
|
+
}, Ca = {
|
|
373
|
+
key: 0,
|
|
374
|
+
class: "it-thread__error"
|
|
375
|
+
}, Sa = {
|
|
376
|
+
key: 0,
|
|
377
|
+
class: "it-thread__bubble it-thread__bubble--assistant it-thread__thinking",
|
|
378
|
+
"aria-label": "Thinking"
|
|
379
|
+
}, nt = /* @__PURE__ */ ye({
|
|
380
|
+
__name: "ItAssistantThread",
|
|
381
|
+
props: {
|
|
382
|
+
messages: {},
|
|
383
|
+
busy: { type: Boolean },
|
|
384
|
+
placeholder: { default: "Ask a question…" },
|
|
385
|
+
navigate: { type: Function, default: void 0 }
|
|
386
|
+
},
|
|
387
|
+
emits: ["send", "stop", "retry", "review"],
|
|
388
|
+
setup(t, { expose: h, emit: _ }) {
|
|
389
|
+
var ge;
|
|
390
|
+
const n = t, l = _, m = M(""), g = M(null), y = M(null), i = typeof window < "u" && ((ge = window.matchMedia) == null ? void 0 : ge.call(window, "(prefers-reduced-motion: reduce)").matches), r = { slowest: 12, fastest: 90, finishing: 240, catchUp: 0.6 }, u = gt(Re, null) ?? M({});
|
|
391
|
+
u.value = {
|
|
392
|
+
...u.value,
|
|
393
|
+
...Object.fromEntries(n.messages.filter((s) => s.role === "assistant" && s.done && !s.stopped).map((s) => [s.id, s.text.length]))
|
|
394
|
+
};
|
|
395
|
+
let d = 0, A = 0;
|
|
396
|
+
const H = (s) => s.role === "user" || !!s.stopped || (u.value[s.id] ?? 0) >= s.text.length, E = T(() => {
|
|
397
|
+
let s = 0;
|
|
398
|
+
for (const w of n.messages)
|
|
399
|
+
if (s += 1, w.role === "assistant" && !(w.done && H(w))) break;
|
|
400
|
+
return s;
|
|
401
|
+
}), j = T(() => n.messages.slice(0, E.value));
|
|
402
|
+
function I(s) {
|
|
403
|
+
const w = A ? Math.min(0.1, (s - A) / 1e3) : 0.016;
|
|
404
|
+
A = s;
|
|
405
|
+
let k = !1;
|
|
406
|
+
const x = { ...u.value };
|
|
407
|
+
for (const O of j.value) {
|
|
408
|
+
if (O.role !== "assistant" || O.stopped) continue;
|
|
409
|
+
const be = x[O.id] ?? 0, fe = O.text.length - be;
|
|
410
|
+
if (fe <= 0) continue;
|
|
411
|
+
const he = Math.min(O.done ? r.finishing : r.fastest, Math.max(r.slowest, fe / r.catchUp));
|
|
412
|
+
x[O.id] = Math.min(O.text.length, be + Math.max(1, Math.round(he * w))), k = !0;
|
|
413
|
+
}
|
|
414
|
+
u.value = x, k || (k = j.value.some((O) => O.role === "assistant" && !O.stopped && (x[O.id] ?? 0) < O.text.length)), d = k ? requestAnimationFrame(I) : 0, k || (A = 0);
|
|
415
|
+
}
|
|
416
|
+
ee(
|
|
417
|
+
() => `${E.value}|${n.messages.map((s) => `${s.id}:${s.text.length}`).join()}`,
|
|
418
|
+
() => {
|
|
419
|
+
if (i || typeof requestAnimationFrame > "u") {
|
|
420
|
+
u.value = Object.fromEntries(n.messages.map((s) => [s.id, s.text.length]));
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
d || (d = requestAnimationFrame(I));
|
|
424
|
+
},
|
|
425
|
+
{ immediate: !0 }
|
|
426
|
+
), qe(() => cancelAnimationFrame(d));
|
|
427
|
+
const $ = (s) => s.role === "user" ? s.text : s.text.slice(0, u.value[s.id] ?? 0), q = (s) => s.role === "assistant" && !s.stopped && (!s.done || (u.value[s.id] ?? 0) < s.text.length), P = T(() => {
|
|
428
|
+
const s = n.messages[n.messages.length - 1];
|
|
429
|
+
return n.busy && E.value === n.messages.length && !!s && s.role === "assistant" && !s.text && !s.tools.length;
|
|
430
|
+
});
|
|
431
|
+
let K = !0;
|
|
432
|
+
function J() {
|
|
433
|
+
const s = g.value;
|
|
434
|
+
s && (K = s.scrollHeight - s.scrollTop - s.clientHeight < 56);
|
|
435
|
+
}
|
|
436
|
+
ee(
|
|
437
|
+
() => [n.messages.length, Object.values(u.value).reduce((s, w) => s + w, 0), n.messages.map((s) => s.tools.length).join()],
|
|
438
|
+
async () => {
|
|
439
|
+
await G(), K && g.value && (g.value.scrollTop = g.value.scrollHeight);
|
|
440
|
+
}
|
|
441
|
+
), ee(
|
|
442
|
+
() => n.messages.length,
|
|
443
|
+
() => K = !0
|
|
444
|
+
), Ze(() => {
|
|
445
|
+
g.value && (g.value.scrollTop = g.value.scrollHeight);
|
|
446
|
+
});
|
|
447
|
+
const oe = M(null);
|
|
448
|
+
ee(
|
|
449
|
+
() => n.busy,
|
|
450
|
+
async () => {
|
|
451
|
+
var s, w, k;
|
|
452
|
+
!((s = oe.value) != null && s.contains(document.activeElement)) || document.activeElement === ((w = y.value) == null ? void 0 : w.$el) || (await G(), (k = oe.value) != null && k.contains(document.activeElement) || ke());
|
|
453
|
+
}
|
|
454
|
+
);
|
|
455
|
+
function Q() {
|
|
456
|
+
l("retry"), G(() => {
|
|
457
|
+
var s;
|
|
458
|
+
(s = g.value) != null && s.contains(document.activeElement) || ke();
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
function re() {
|
|
462
|
+
const s = m.value.trim();
|
|
463
|
+
!s || n.busy || (l("send", s), m.value = "");
|
|
464
|
+
}
|
|
465
|
+
function ve(s) {
|
|
466
|
+
s.key !== "Enter" || s.shiftKey || s.isComposing || (s.preventDefault(), re());
|
|
467
|
+
}
|
|
468
|
+
function ke() {
|
|
469
|
+
var s;
|
|
470
|
+
(s = y.value) == null || s.$el.focus({ preventScroll: !0 });
|
|
471
|
+
}
|
|
472
|
+
return h({ focus: ke }), (s, w) => (o(), f("div", fa, [
|
|
473
|
+
p("div", {
|
|
474
|
+
ref_key: "log",
|
|
475
|
+
ref: g,
|
|
476
|
+
class: "it-thread__log",
|
|
477
|
+
role: "log",
|
|
478
|
+
"aria-live": "polite",
|
|
479
|
+
"aria-label": "Conversation",
|
|
480
|
+
onScroll: J
|
|
481
|
+
}, [
|
|
482
|
+
(o(!0), f(L, null, ne(j.value, (k) => (o(), f(L, {
|
|
483
|
+
key: k.id
|
|
484
|
+
}, [
|
|
485
|
+
k.role === "user" ? (o(), f("div", ha, C(k.text), 1)) : (o(), f(L, { key: 1 }, [
|
|
486
|
+
k.tools.length ? (o(), f("ul", pa, [
|
|
487
|
+
(o(!0), f(L, null, ne(k.tools, (x) => (o(), f("li", {
|
|
488
|
+
key: x.id,
|
|
489
|
+
class: Te(["it-thread__tool", `it-thread__tool--${x.state}`])
|
|
490
|
+
}, [
|
|
491
|
+
x.state === "running" ? (o(), N(b(st), {
|
|
492
|
+
key: 0,
|
|
493
|
+
class: "it-thread__spin",
|
|
494
|
+
size: 14,
|
|
495
|
+
"aria-hidden": "true"
|
|
496
|
+
})) : x.state === "done" ? (o(), N(b(qt), {
|
|
497
|
+
key: 1,
|
|
498
|
+
size: 14,
|
|
499
|
+
"aria-hidden": "true"
|
|
500
|
+
})) : (o(), N(b(Rt), {
|
|
501
|
+
key: 2,
|
|
502
|
+
size: 14,
|
|
503
|
+
"aria-hidden": "true"
|
|
504
|
+
})),
|
|
505
|
+
p("span", ma, [
|
|
506
|
+
p("span", null, [
|
|
507
|
+
D(C(x.label), 1),
|
|
508
|
+
p("span", ya, C(x.state === "running" ? ", running" : x.state === "done" ? ", done" : ", failed"), 1)
|
|
509
|
+
]),
|
|
510
|
+
x.detail ? (o(), f("span", ka, C(x.detail), 1)) : S("", !0)
|
|
511
|
+
])
|
|
512
|
+
], 2))), 128))
|
|
513
|
+
])) : S("", !0),
|
|
514
|
+
$(k) ? (o(), f("div", ga, [
|
|
515
|
+
z(va, {
|
|
516
|
+
source: $(k),
|
|
517
|
+
streaming: q(k),
|
|
518
|
+
navigate: t.navigate
|
|
519
|
+
}, null, 8, ["source", "streaming", "navigate"])
|
|
520
|
+
])) : S("", !0),
|
|
521
|
+
k.stopped ? (o(), f("p", ba, "Stopped")) : S("", !0),
|
|
522
|
+
H(k) ? (o(), f(L, { key: 3 }, [
|
|
523
|
+
(o(!0), f(L, null, ne(k.attachments, (x, O) => V(s.$slots, "attachment", { attachment: x }, void 0, void 0, O)), 128)),
|
|
524
|
+
k.action && k.done ? V(s.$slots, "action", {
|
|
525
|
+
action: k.action,
|
|
526
|
+
review: () => l("review", k.action)
|
|
527
|
+
}, () => [
|
|
528
|
+
p("div", _a, [
|
|
529
|
+
w[2] || (w[2] = p("span", { class: "it-thread__action-overline" }, "Ready for review", -1)),
|
|
530
|
+
p("span", wa, C(k.action.title), 1),
|
|
531
|
+
k.action.reasoning ? (o(), f("p", $a, C(k.action.reasoning), 1)) : S("", !0),
|
|
532
|
+
p("div", null, [
|
|
533
|
+
z(b(me), {
|
|
534
|
+
label: "Review",
|
|
535
|
+
size: "small",
|
|
536
|
+
onClick: (x) => l("review", k.action)
|
|
537
|
+
}, null, 8, ["onClick"])
|
|
538
|
+
])
|
|
539
|
+
])
|
|
540
|
+
], void 0, 0) : S("", !0),
|
|
541
|
+
k.error ? (o(), f(L, { key: 1 }, [
|
|
542
|
+
s.$slots.error ? (o(), f("div", Ca, [
|
|
543
|
+
V(s.$slots, "error", {
|
|
544
|
+
message: k.error,
|
|
545
|
+
details: k.errorDetails,
|
|
546
|
+
retry: Q
|
|
547
|
+
})
|
|
548
|
+
])) : (o(), N(at, {
|
|
549
|
+
key: 1,
|
|
550
|
+
tone: "danger",
|
|
551
|
+
class: "it-thread__error"
|
|
552
|
+
}, {
|
|
553
|
+
actions: U(() => [
|
|
554
|
+
z(b(me), {
|
|
555
|
+
label: "Try again",
|
|
556
|
+
severity: "secondary",
|
|
557
|
+
outlined: "",
|
|
558
|
+
size: "small",
|
|
559
|
+
onClick: Q
|
|
560
|
+
})
|
|
561
|
+
]),
|
|
562
|
+
default: U(() => [
|
|
563
|
+
D(C(k.error) + " ", 1)
|
|
564
|
+
]),
|
|
565
|
+
_: 2
|
|
566
|
+
}, 1024))
|
|
567
|
+
], 64)) : S("", !0)
|
|
568
|
+
], 64)) : S("", !0)
|
|
569
|
+
], 64))
|
|
570
|
+
], 64))), 128)),
|
|
571
|
+
P.value ? (o(), f("div", Sa, [...w[3] || (w[3] = [
|
|
572
|
+
p("span", null, null, -1),
|
|
573
|
+
p("span", null, null, -1),
|
|
574
|
+
p("span", null, null, -1)
|
|
575
|
+
])])) : S("", !0)
|
|
576
|
+
], 544),
|
|
577
|
+
p("form", {
|
|
578
|
+
ref_key: "form",
|
|
579
|
+
ref: oe,
|
|
580
|
+
class: "it-thread__composer",
|
|
581
|
+
onSubmit: bt(re, ["prevent"])
|
|
582
|
+
}, [
|
|
583
|
+
z(b(Wt), {
|
|
584
|
+
ref_key: "composer",
|
|
585
|
+
ref: y,
|
|
586
|
+
modelValue: m.value,
|
|
587
|
+
"onUpdate:modelValue": w[0] || (w[0] = (k) => m.value = k),
|
|
588
|
+
class: "it-thread__input",
|
|
589
|
+
rows: "2",
|
|
590
|
+
"auto-resize": "",
|
|
591
|
+
placeholder: t.placeholder,
|
|
592
|
+
"aria-label": "Message",
|
|
593
|
+
onKeydown: ve
|
|
594
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
595
|
+
t.busy ? (o(), N(b(me), {
|
|
596
|
+
key: 0,
|
|
597
|
+
type: "button",
|
|
598
|
+
severity: "secondary",
|
|
599
|
+
outlined: "",
|
|
600
|
+
class: "it-thread__send",
|
|
601
|
+
"aria-label": "Stop generating",
|
|
602
|
+
onClick: w[1] || (w[1] = (k) => l("stop"))
|
|
603
|
+
}, {
|
|
604
|
+
icon: U(() => [
|
|
605
|
+
z(b(Pt), {
|
|
606
|
+
size: 14,
|
|
607
|
+
"aria-hidden": "true"
|
|
608
|
+
})
|
|
609
|
+
]),
|
|
610
|
+
_: 1
|
|
611
|
+
})) : (o(), N(b(me), {
|
|
612
|
+
key: 1,
|
|
613
|
+
type: "submit",
|
|
614
|
+
class: "it-thread__send",
|
|
615
|
+
"aria-label": "Send",
|
|
616
|
+
disabled: !m.value.trim()
|
|
617
|
+
}, {
|
|
618
|
+
icon: U(() => [
|
|
619
|
+
z(b(Dt), {
|
|
620
|
+
size: 16,
|
|
621
|
+
"aria-hidden": "true"
|
|
622
|
+
})
|
|
623
|
+
]),
|
|
624
|
+
_: 1
|
|
625
|
+
}, 8, ["disabled"]))
|
|
626
|
+
], 544)
|
|
627
|
+
]));
|
|
628
|
+
}
|
|
629
|
+
}), Ta = { class: "it-palette__field" }, xa = { class: "it-palette__field-side" }, La = ["aria-activedescendant", "aria-label", "placeholder"], Aa = { class: "it-palette__field-side" }, Ia = {
|
|
630
|
+
key: 1,
|
|
631
|
+
"aria-hidden": "true"
|
|
632
|
+
}, ja = ["aria-label"], Ba = ["aria-labelledby", "aria-label"], Ma = ["id"], Ea = ["id", "aria-selected", "onMousemove", "onClick"], za = {
|
|
633
|
+
class: "it-palette__icon",
|
|
634
|
+
"aria-hidden": "true"
|
|
635
|
+
}, qa = { class: "it-palette__text" }, Ra = { class: "it-palette__label" }, Pa = { class: "it-palette__meta" }, Da = {
|
|
636
|
+
key: 0,
|
|
637
|
+
class: "it-palette__badge"
|
|
638
|
+
}, Na = {
|
|
639
|
+
key: 0,
|
|
640
|
+
class: "it-palette__empty"
|
|
641
|
+
}, Ha = {
|
|
642
|
+
class: "it-palette__footer",
|
|
643
|
+
"aria-hidden": "true"
|
|
644
|
+
}, Ka = { key: 0 }, Oa = {
|
|
645
|
+
key: 1,
|
|
646
|
+
class: "it-palette__credit"
|
|
647
|
+
}, Wa = {
|
|
648
|
+
class: "it-sr-only",
|
|
649
|
+
"aria-live": "polite"
|
|
650
|
+
}, Ua = { class: "it-palette__chat-head" }, Va = { class: "it-palette__chat-title" }, Fa = ["aria-label"], Ga = { class: "it-palette__chat-head" }, Ja = { class: "it-palette__chat-title" }, bs = /* @__PURE__ */ ye({
|
|
651
|
+
__name: "ItCommandPalette",
|
|
652
|
+
props: {
|
|
653
|
+
visible: { type: Boolean },
|
|
654
|
+
sources: {},
|
|
655
|
+
jumpTo: { default: () => [] },
|
|
656
|
+
starters: { default: () => [] },
|
|
657
|
+
assistant: { default: null },
|
|
658
|
+
session: { default: null },
|
|
659
|
+
assistantName: { default: "Assistant" },
|
|
660
|
+
poweredBy: { default: void 0 },
|
|
661
|
+
placeholder: { default: void 0 },
|
|
662
|
+
askPlaceholder: { default: "Ask a question…" },
|
|
663
|
+
reviewTitle: { default: "Review draft" },
|
|
664
|
+
reviewBusy: { type: Boolean },
|
|
665
|
+
beforeReviewLeave: {},
|
|
666
|
+
debounce: { default: 160 }
|
|
667
|
+
},
|
|
668
|
+
emits: ["update:visible", "select", "review"],
|
|
669
|
+
setup(t, { expose: h, emit: _ }) {
|
|
670
|
+
var Ge;
|
|
671
|
+
const n = t, l = _, m = _t(), g = wt(), y = `it-palette-${g}-list`, i = (e) => `it-palette-${g}-option-${e}`, r = (Ge = $t()) == null ? void 0 : Ge.appContext.config.globalProperties.$router, u = M("search"), d = M(""), A = M(null), H = M(null), E = T(() => !!n.assistant || !!n.session), j = M({}), I = {}, $ = {};
|
|
672
|
+
let q = 0;
|
|
673
|
+
function P(e, a) {
|
|
674
|
+
var v, X, ce;
|
|
675
|
+
const c = a ? q : ++q;
|
|
676
|
+
for (const R of a ? [a] : n.sources) {
|
|
677
|
+
const W = $[v = R.key] ?? ($[v] = {});
|
|
678
|
+
if (clearTimeout(W.timer), (X = W.release) == null || X.call(W), W.release = void 0, W.done = void 0, (ce = W.controller) == null || ce.abort(), e.length < (R.minLength ?? 1)) {
|
|
679
|
+
j.value = { ...j.value, [R.key]: { items: [], for: e, loading: !1 } };
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
const $e = I[R.key];
|
|
683
|
+
if (R.remote && $e && e.toLowerCase().startsWith($e.toLowerCase())) {
|
|
684
|
+
j.value = { ...j.value, [R.key]: { items: [], for: e, loading: !1 } };
|
|
685
|
+
continue;
|
|
686
|
+
}
|
|
687
|
+
$e && !e.toLowerCase().startsWith($e.toLowerCase()) && delete I[R.key];
|
|
688
|
+
const Ce = new AbortController();
|
|
689
|
+
W.controller = Ce;
|
|
690
|
+
const Je = async () => {
|
|
691
|
+
try {
|
|
692
|
+
const de = await R.search(e, { signal: Ce.signal });
|
|
693
|
+
if (c !== q || Ce.signal.aborted) return;
|
|
694
|
+
R.remote && !de.length && (I[R.key] = e), j.value = { ...j.value, [R.key]: { items: de, for: e, loading: !1 } };
|
|
695
|
+
} catch (de) {
|
|
696
|
+
c === q && !Ce.signal.aborted && (j.value = { ...j.value, [R.key]: { items: [], for: e, loading: !1, failed: !0, error: de } });
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
R.remote ? (j.value = { ...j.value, [R.key]: { items: [], for: e, loading: !0 } }, W.done = new Promise((de) => {
|
|
700
|
+
W.release = de, W.timer = setTimeout(() => void Je().finally(de), n.debounce);
|
|
701
|
+
})) : W.done = Je();
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
ee(d, (e) => {
|
|
705
|
+
w.value = !1, s.value = 0, P(e.trim());
|
|
706
|
+
});
|
|
707
|
+
const K = T(() => It(d.value)), J = T(() => E.value && d.value.trim() ? { key: "ask", label: K.value === "ask" ? void 0 : "Ask the assistant", rows: [{ kind: "ask", text: d.value.trim() }] } : null), oe = T(() => {
|
|
708
|
+
const e = d.value.trim();
|
|
709
|
+
if (!e) {
|
|
710
|
+
const c = [];
|
|
711
|
+
return E.value && n.starters.length && c.push({ key: "starters", label: "Ask the assistant", rows: n.starters.map((v) => ({ kind: "starter", starter: v })) }), n.jumpTo.length && c.push({ key: "jump", label: "Jump to", rows: n.jumpTo.map((v) => ({ kind: "item", item: v })) }), c;
|
|
712
|
+
}
|
|
713
|
+
const a = n.sources.flatMap((c) => {
|
|
714
|
+
const v = j.value[c.key];
|
|
715
|
+
if (!v || v.for !== e) return c.remote ? [{ key: c.key, label: c.label, loading: !0, rows: [] }] : [];
|
|
716
|
+
if (v.loading) return [{ key: c.key, label: c.label, loading: !0, rows: [] }];
|
|
717
|
+
const X = v.items.slice(0, c.limit ?? 5).map((ce) => ({ kind: "item", item: ce }));
|
|
718
|
+
return X.length ? [{ key: c.key, label: c.label, rows: X }] : [];
|
|
719
|
+
});
|
|
720
|
+
return J.value ? K.value === "ask" ? [J.value, ...a] : [...a, J.value] : a;
|
|
721
|
+
}), Q = T(() => oe.value.flatMap((e) => e.rows)), re = T(() => oe.value.some((e) => e.loading)), ve = T(() => n.sources.filter((e) => {
|
|
722
|
+
var a, c;
|
|
723
|
+
return ((a = j.value[e.key]) == null ? void 0 : a.failed) && ((c = j.value[e.key]) == null ? void 0 : c.for) === d.value.trim();
|
|
724
|
+
})), ke = T(() => !!d.value.trim() && !re.value && !ve.value.length && !Q.value.some((e) => e.kind === "item"));
|
|
725
|
+
function ge(e) {
|
|
726
|
+
!n.visible || u.value !== "search" || (delete I[e.key], P(d.value.trim(), e));
|
|
727
|
+
}
|
|
728
|
+
const s = M(0), w = M(!1), k = T(() => new Map(Q.value.map((e, a) => [e, a]))), x = (e) => k.value.get(e) ?? -1;
|
|
729
|
+
function O(e) {
|
|
730
|
+
const a = Q.value.length;
|
|
731
|
+
a && (!w.value && !d.value.trim() && (s.value = e > 0 ? -1 : 0), w.value = !0, s.value = (s.value + e + a) % a, G(() => {
|
|
732
|
+
const c = document.getElementById(i(s.value));
|
|
733
|
+
c && Mt(c, { container: document.getElementById(y) });
|
|
734
|
+
}));
|
|
735
|
+
}
|
|
736
|
+
const be = M("");
|
|
737
|
+
let fe;
|
|
738
|
+
ee([Q, re], () => {
|
|
739
|
+
clearTimeout(fe), fe = setTimeout(() => {
|
|
740
|
+
if (!n.visible || u.value !== "search" || re.value || !d.value.trim()) return;
|
|
741
|
+
const e = Q.value.filter((a) => a.kind === "item").length;
|
|
742
|
+
be.value = ve.value.length ? `${e} results. ${ve.value.map((a) => a.label).join(", ")} could not load.` : e ? `${e} ${e === 1 ? "result" : "results"}` : "No matches";
|
|
743
|
+
}, 600);
|
|
744
|
+
});
|
|
745
|
+
async function he(e) {
|
|
746
|
+
if (!e) return;
|
|
747
|
+
if (e.kind === "ask") return pe(e.text);
|
|
748
|
+
if (e.kind === "starter") return pe(e.starter.prompt);
|
|
749
|
+
const a = e.item;
|
|
750
|
+
Z(), a.run ? await a.run() : a.to !== void 0 && r ? await r.push(a.to) : a.href ? window.location.assign(a.href) : typeof a.to == "string" && window.location.assign(a.to), l("select", a);
|
|
751
|
+
}
|
|
752
|
+
async function Pe() {
|
|
753
|
+
const e = Object.values($).map((a) => a.done).filter(Boolean);
|
|
754
|
+
await Promise.race([Promise.all(e), new Promise((a) => setTimeout(a, 1500))]), await G();
|
|
755
|
+
}
|
|
756
|
+
const xe = M(!1);
|
|
757
|
+
let te = null, Le = 0;
|
|
758
|
+
async function ot() {
|
|
759
|
+
var ce;
|
|
760
|
+
const e = d.value.trim();
|
|
761
|
+
if (w.value) return he(Q.value[s.value]);
|
|
762
|
+
if (!e) return;
|
|
763
|
+
const a = () => Q.value.find((R) => R.kind === "item"), c = Le, v = () => c !== Le || !n.visible || u.value !== "search" || d.value.trim() !== e;
|
|
764
|
+
if (!E.value)
|
|
765
|
+
return await Pe(), v() ? void 0 : he(a());
|
|
766
|
+
if (K.value === "ask") return pe(e);
|
|
767
|
+
if (K.value === "ambiguous" && ((ce = n.assistant) != null && ce.route)) {
|
|
768
|
+
xe.value = !0, te = new AbortController();
|
|
769
|
+
const R = setTimeout(() => te == null ? void 0 : te.abort(), 4e3);
|
|
770
|
+
let W = "search";
|
|
771
|
+
try {
|
|
772
|
+
W = await n.assistant.route(e, te.signal);
|
|
773
|
+
} catch {
|
|
774
|
+
W = "search";
|
|
775
|
+
} finally {
|
|
776
|
+
clearTimeout(R), xe.value = !1;
|
|
777
|
+
}
|
|
778
|
+
if (v()) return;
|
|
779
|
+
if (W === "ask") return pe(e);
|
|
780
|
+
}
|
|
781
|
+
if (await Pe(), v()) return;
|
|
782
|
+
const X = a();
|
|
783
|
+
return X ? he(X) : pe(e);
|
|
784
|
+
}
|
|
785
|
+
function rt(e) {
|
|
786
|
+
e.isComposing || (e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), O(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), ot()) : e.key === "Tab" && !e.shiftKey && E.value && d.value.trim() && (e.preventDefault(), pe(d.value.trim())));
|
|
787
|
+
}
|
|
788
|
+
const De = jt(() => n.assistant), Y = T(() => n.session ?? De), Ne = T(() => Y.value.messages.value), He = T(() => Y.value.busy.value);
|
|
789
|
+
et(Re, T({ get: () => Y.value.shown.value, set: (e) => Y.value.shown.value = e }));
|
|
790
|
+
async function pe(e) {
|
|
791
|
+
var a;
|
|
792
|
+
E.value && (u.value = "chat", await G(), (a = H.value) == null || a.focus(), !He.value && Y.value.send(e));
|
|
793
|
+
}
|
|
794
|
+
const ut = (e) => Y.value.send(e), Ke = () => Y.value.stop(), ct = () => Y.value.retry();
|
|
795
|
+
function Ae() {
|
|
796
|
+
ue += 1, Y.value.newThread(), _e.value = null, u.value === "review" && (u.value = "chat"), G(() => {
|
|
797
|
+
var e;
|
|
798
|
+
return (e = H.value) == null ? void 0 : e.focus();
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
const _e = M(null), Ie = M(null), we = M(!1);
|
|
802
|
+
let ue = 0;
|
|
803
|
+
async function Oe(e) {
|
|
804
|
+
var c;
|
|
805
|
+
if (u.value !== "review") return !0;
|
|
806
|
+
if (n.reviewBusy || we.value) return !1;
|
|
807
|
+
const a = ue;
|
|
808
|
+
we.value = !0;
|
|
809
|
+
try {
|
|
810
|
+
return await (((c = n.beforeReviewLeave) == null ? void 0 : c.call(n, e)) ?? !0) && a === ue && n.visible && !n.reviewBusy;
|
|
811
|
+
} catch {
|
|
812
|
+
return !1;
|
|
813
|
+
} finally {
|
|
814
|
+
we.value = !1;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
async function dt(e) {
|
|
818
|
+
var a;
|
|
819
|
+
ue += 1, l("review", e), m.review && (_e.value = e, u.value = "review", await G(), (a = Ie.value) == null || a.focus({ preventScroll: !0 }));
|
|
820
|
+
}
|
|
821
|
+
async function We() {
|
|
822
|
+
var e;
|
|
823
|
+
await Oe("back") && (u.value = "chat", _e.value = null, await G(), (e = H.value) == null || e.focus());
|
|
824
|
+
}
|
|
825
|
+
function vt() {
|
|
826
|
+
Ae(), u.value = "chat", Z();
|
|
827
|
+
}
|
|
828
|
+
const je = T(() => _e.value ? { action: _e.value, back: () => void We(), done: vt } : null);
|
|
829
|
+
async function Ue() {
|
|
830
|
+
var e, a;
|
|
831
|
+
ue += 1, u.value = "search", await G(), (e = A.value) == null || e.focus({ preventScroll: !0 }), (a = A.value) == null || a.select();
|
|
832
|
+
}
|
|
833
|
+
function ft(e) {
|
|
834
|
+
Z(), r ? r.push(e) : window.location.assign(e);
|
|
835
|
+
}
|
|
836
|
+
async function Z() {
|
|
837
|
+
await Oe("close") && l("update:visible", !1);
|
|
838
|
+
}
|
|
839
|
+
function ht() {
|
|
840
|
+
G(() => {
|
|
841
|
+
var e, a, c, v;
|
|
842
|
+
if (u.value === "review") return (e = Ie.value) == null ? void 0 : e.focus({ preventScroll: !0 });
|
|
843
|
+
if (u.value === "chat") return (a = H.value) == null ? void 0 : a.focus();
|
|
844
|
+
(c = A.value) == null || c.focus({ preventScroll: !0 }), (v = A.value) == null || v.select(), P(d.value.trim());
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
ee(
|
|
848
|
+
() => n.visible,
|
|
849
|
+
(e) => {
|
|
850
|
+
e || (ue += 1, Le += 1, n.session || Ke(), te == null || te.abort());
|
|
851
|
+
}
|
|
852
|
+
);
|
|
853
|
+
function Ve(e) {
|
|
854
|
+
e.preventDefault(), u.value === "search" && d.value ? d.value = "" : Z();
|
|
855
|
+
}
|
|
856
|
+
function pt(e) {
|
|
857
|
+
(e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k" ? (e.preventDefault(), Z()) : e.key === "Escape" && (e.stopPropagation(), Ve(e));
|
|
858
|
+
}
|
|
859
|
+
Kt(() => n.visible, Ve);
|
|
860
|
+
let Fe = "";
|
|
861
|
+
ee(
|
|
862
|
+
d,
|
|
863
|
+
(e) => G(() => {
|
|
864
|
+
const a = A.value;
|
|
865
|
+
if (!a) return;
|
|
866
|
+
const c = e.startsWith(Fe);
|
|
867
|
+
Fe = e, !(c && a.scrollHeight <= a.clientHeight) && (a.style.height = "auto", a.style.height = `${a.scrollHeight}px`);
|
|
868
|
+
})
|
|
869
|
+
), qe(() => {
|
|
870
|
+
var e;
|
|
871
|
+
ue += 1, clearTimeout(fe);
|
|
872
|
+
for (const a of Object.values($))
|
|
873
|
+
clearTimeout(a.timer), (e = a.controller) == null || e.abort();
|
|
874
|
+
De.stop();
|
|
875
|
+
}), h({ newThread: Ae, showSearch: Ue, requestClose: Z });
|
|
876
|
+
const mt = T(() => u.value === "review" ? n.reviewTitle : u.value === "chat" ? n.assistantName : "Search"), Be = T(() => n.placeholder ?? (E.value ? "Search or ask…" : "Search…")), yt = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform) ? "⌘" : "Ctrl";
|
|
877
|
+
return (e, a) => (o(), N(b(xt), {
|
|
878
|
+
visible: t.visible,
|
|
879
|
+
modal: "",
|
|
880
|
+
"dismissable-mask": "",
|
|
881
|
+
draggable: !1,
|
|
882
|
+
"show-header": !1,
|
|
883
|
+
"close-on-escape": !1,
|
|
884
|
+
position: "top",
|
|
885
|
+
"aria-label": mt.value,
|
|
886
|
+
class: Te(["it-palette", `it-palette--${u.value}`]),
|
|
887
|
+
pt: { mask: { class: "it-palette-mask" }, content: { class: "it-palette__content", onKeydown: pt } },
|
|
888
|
+
"onUpdate:visible": a[1] || (a[1] = (c) => c ? l("update:visible", !0) : Z()),
|
|
889
|
+
onShow: ht
|
|
890
|
+
}, {
|
|
891
|
+
default: U(() => [
|
|
892
|
+
u.value === "search" ? (o(), f(L, { key: 0 }, [
|
|
893
|
+
p("div", Ta, [
|
|
894
|
+
p("span", xa, [
|
|
895
|
+
z(b(Nt), {
|
|
896
|
+
size: 18,
|
|
897
|
+
"aria-hidden": "true"
|
|
898
|
+
})
|
|
899
|
+
]),
|
|
900
|
+
Ct(p("textarea", {
|
|
901
|
+
ref_key: "input",
|
|
902
|
+
ref: A,
|
|
903
|
+
"onUpdate:modelValue": a[0] || (a[0] = (c) => d.value = c),
|
|
904
|
+
class: "it-palette__input",
|
|
905
|
+
rows: "1",
|
|
906
|
+
role: "combobox",
|
|
907
|
+
"aria-autocomplete": "list",
|
|
908
|
+
"aria-expanded": "true",
|
|
909
|
+
"aria-controls": y,
|
|
910
|
+
"aria-activedescendant": Q.value.length && w.value ? i(s.value) : void 0,
|
|
911
|
+
"aria-label": Be.value.replace("…", ""),
|
|
912
|
+
placeholder: Be.value,
|
|
913
|
+
autocomplete: "off",
|
|
914
|
+
spellcheck: "false",
|
|
915
|
+
onKeydown: rt
|
|
916
|
+
}, null, 40, La), [
|
|
917
|
+
[St, d.value]
|
|
918
|
+
]),
|
|
919
|
+
p("span", Aa, [
|
|
920
|
+
xe.value || re.value ? (o(), N(b(st), {
|
|
921
|
+
key: 0,
|
|
922
|
+
class: "it-palette__spinner",
|
|
923
|
+
size: 16,
|
|
924
|
+
"aria-label": "Searching"
|
|
925
|
+
})) : (o(), f("kbd", Ia, "esc"))
|
|
926
|
+
])
|
|
927
|
+
]),
|
|
928
|
+
p("div", {
|
|
929
|
+
id: y,
|
|
930
|
+
class: "it-palette__list",
|
|
931
|
+
role: "listbox",
|
|
932
|
+
"aria-label": Be.value.replace("…", "")
|
|
933
|
+
}, [
|
|
934
|
+
(o(!0), f(L, null, ne(oe.value, (c) => (o(), f("div", {
|
|
935
|
+
key: c.key,
|
|
936
|
+
class: "it-palette__section",
|
|
937
|
+
role: "group",
|
|
938
|
+
"aria-labelledby": c.label ? `${y}-${c.key}` : void 0,
|
|
939
|
+
"aria-label": c.label ? void 0 : "Ask the assistant"
|
|
940
|
+
}, [
|
|
941
|
+
c.label ? (o(), f("div", {
|
|
942
|
+
key: 0,
|
|
943
|
+
id: `${y}-${c.key}`,
|
|
944
|
+
class: "it-palette__heading",
|
|
945
|
+
role: "presentation"
|
|
946
|
+
}, C(c.label), 9, Ma)) : S("", !0),
|
|
947
|
+
c.loading ? (o(), N(Bt, {
|
|
948
|
+
key: 1,
|
|
949
|
+
kind: "list",
|
|
950
|
+
rows: 3,
|
|
951
|
+
class: "it-palette__skeleton",
|
|
952
|
+
"aria-hidden": "true"
|
|
953
|
+
})) : S("", !0),
|
|
954
|
+
(o(!0), f(L, null, ne(c.rows, (v) => (o(), f("div", {
|
|
955
|
+
id: i(x(v)),
|
|
956
|
+
key: v.kind === "item" ? v.item.id : v.kind === "ask" ? "ask" : v.starter.label,
|
|
957
|
+
class: Te(["it-palette__row", { "it-palette__row--active": x(v) === s.value && (w.value || !!d.value.trim()), "it-palette__row--ask": v.kind !== "item" }]),
|
|
958
|
+
role: "option",
|
|
959
|
+
"aria-selected": x(v) === s.value && w.value,
|
|
960
|
+
onMousemove: (X) => (s.value = x(v), w.value = !0),
|
|
961
|
+
onClick: (X) => he(v)
|
|
962
|
+
}, [
|
|
963
|
+
p("span", za, [
|
|
964
|
+
v.kind !== "item" ? (o(), N(b(Me), {
|
|
965
|
+
key: 0,
|
|
966
|
+
size: 16
|
|
967
|
+
})) : v.item.platform ? (o(), N(Ot, {
|
|
968
|
+
key: 1,
|
|
969
|
+
platform: v.item.platform,
|
|
970
|
+
size: 16,
|
|
971
|
+
decorative: ""
|
|
972
|
+
}, null, 8, ["platform"])) : v.item.icon ? (o(), N(Tt(v.item.icon), {
|
|
973
|
+
key: 2,
|
|
974
|
+
size: 16
|
|
975
|
+
})) : S("", !0)
|
|
976
|
+
]),
|
|
977
|
+
p("span", qa, [
|
|
978
|
+
p("span", Ra, [
|
|
979
|
+
v.kind === "item" ? (o(), f(L, { key: 0 }, [
|
|
980
|
+
D(C(v.item.label), 1)
|
|
981
|
+
], 64)) : v.kind === "ask" ? (o(), f(L, { key: 1 }, [
|
|
982
|
+
D("Ask the assistant: “" + C(v.text) + "”", 1)
|
|
983
|
+
], 64)) : (o(), f(L, { key: 2 }, [
|
|
984
|
+
D(C(v.starter.label), 1)
|
|
985
|
+
], 64))
|
|
986
|
+
]),
|
|
987
|
+
p("span", Pa, [
|
|
988
|
+
v.kind === "item" ? (o(), f(L, { key: 0 }, [
|
|
989
|
+
D(C(v.item.meta), 1)
|
|
990
|
+
], 64)) : v.kind === "ask" ? (o(), f(L, { key: 1 }, [
|
|
991
|
+
D("Starts a conversation that can look up and draft for you")
|
|
992
|
+
], 64)) : (o(), f(L, { key: 2 }, [
|
|
993
|
+
D(C(v.starter.prompt), 1)
|
|
994
|
+
], 64))
|
|
995
|
+
])
|
|
996
|
+
]),
|
|
997
|
+
v.kind !== "item" || v.item.badge ? (o(), f("span", Da, C(v.kind === "item" ? v.item.badge : "Ask"), 1)) : S("", !0)
|
|
998
|
+
], 42, Ea))), 128))
|
|
999
|
+
], 8, Ba))), 128)),
|
|
1000
|
+
ke.value ? (o(), f("p", Na, [
|
|
1001
|
+
D(" No matches for “" + C(d.value.trim()) + "”.", 1),
|
|
1002
|
+
E.value ? (o(), f(L, { key: 0 }, [
|
|
1003
|
+
a[2] || (a[2] = D(" Press ", -1)),
|
|
1004
|
+
a[3] || (a[3] = p("kbd", null, "Enter", -1)),
|
|
1005
|
+
a[4] || (a[4] = D(" to ask the assistant.", -1))
|
|
1006
|
+
], 64)) : S("", !0)
|
|
1007
|
+
])) : S("", !0)
|
|
1008
|
+
], 8, ja),
|
|
1009
|
+
(o(!0), f(L, null, ne(ve.value, (c) => {
|
|
1010
|
+
var v;
|
|
1011
|
+
return o(), f("div", {
|
|
1012
|
+
key: c.key,
|
|
1013
|
+
class: "it-palette__source-error"
|
|
1014
|
+
}, [
|
|
1015
|
+
V(e.$slots, "source-error", {
|
|
1016
|
+
source: c,
|
|
1017
|
+
error: (v = j.value[c.key]) == null ? void 0 : v.error,
|
|
1018
|
+
retry: () => ge(c)
|
|
1019
|
+
}, () => [
|
|
1020
|
+
z(at, {
|
|
1021
|
+
tone: "danger",
|
|
1022
|
+
title: `${c.label} could not load`
|
|
1023
|
+
}, {
|
|
1024
|
+
actions: U(() => [
|
|
1025
|
+
z(b(me), {
|
|
1026
|
+
label: "Retry",
|
|
1027
|
+
severity: "secondary",
|
|
1028
|
+
outlined: "",
|
|
1029
|
+
size: "small",
|
|
1030
|
+
onClick: (X) => ge(c)
|
|
1031
|
+
}, null, 8, ["onClick"])
|
|
1032
|
+
]),
|
|
1033
|
+
default: U(() => [
|
|
1034
|
+
a[5] || (a[5] = D(" Try this search again. ", -1))
|
|
1035
|
+
]),
|
|
1036
|
+
_: 2
|
|
1037
|
+
}, 1032, ["title"])
|
|
1038
|
+
])
|
|
1039
|
+
]);
|
|
1040
|
+
}), 128)),
|
|
1041
|
+
p("div", Ha, [
|
|
1042
|
+
a[9] || (a[9] = p("span", null, [
|
|
1043
|
+
p("kbd", null, "↑"),
|
|
1044
|
+
p("kbd", null, "↓"),
|
|
1045
|
+
D(" Navigate")
|
|
1046
|
+
], -1)),
|
|
1047
|
+
a[10] || (a[10] = p("span", null, [
|
|
1048
|
+
p("kbd", null, "↵"),
|
|
1049
|
+
D(" Select")
|
|
1050
|
+
], -1)),
|
|
1051
|
+
E.value ? (o(), f("span", Ka, [...a[6] || (a[6] = [
|
|
1052
|
+
p("kbd", null, "⇥", -1),
|
|
1053
|
+
D(" Ask", -1)
|
|
1054
|
+
])])) : S("", !0),
|
|
1055
|
+
p("span", null, [
|
|
1056
|
+
p("kbd", null, C(b(yt)), 1),
|
|
1057
|
+
a[7] || (a[7] = p("kbd", null, "K", -1)),
|
|
1058
|
+
a[8] || (a[8] = D(" Close", -1))
|
|
1059
|
+
]),
|
|
1060
|
+
t.poweredBy ? (o(), f("span", Oa, [
|
|
1061
|
+
z(b(Me), { size: 12 }),
|
|
1062
|
+
D(C(t.poweredBy), 1)
|
|
1063
|
+
])) : S("", !0)
|
|
1064
|
+
]),
|
|
1065
|
+
p("span", Wa, C(be.value), 1)
|
|
1066
|
+
], 64)) : u.value === "review" && je.value ? (o(), f(L, { key: 1 }, [
|
|
1067
|
+
p("div", Ua, [
|
|
1068
|
+
z(le, {
|
|
1069
|
+
icon: b(Qe),
|
|
1070
|
+
label: "Back to conversation",
|
|
1071
|
+
disabled: t.reviewBusy || we.value,
|
|
1072
|
+
onClick: We
|
|
1073
|
+
}, null, 8, ["icon", "disabled"]),
|
|
1074
|
+
p("h2", Va, C(t.reviewTitle), 1),
|
|
1075
|
+
V(e.$slots, "review-actions", ae(se(je.value))),
|
|
1076
|
+
z(le, {
|
|
1077
|
+
icon: b(ze),
|
|
1078
|
+
label: "Close",
|
|
1079
|
+
tooltip: !1,
|
|
1080
|
+
disabled: t.reviewBusy || we.value,
|
|
1081
|
+
onClick: Z
|
|
1082
|
+
}, null, 8, ["icon", "disabled"])
|
|
1083
|
+
]),
|
|
1084
|
+
p("div", {
|
|
1085
|
+
ref_key: "reviewBody",
|
|
1086
|
+
ref: Ie,
|
|
1087
|
+
class: "it-palette__review",
|
|
1088
|
+
tabindex: "-1",
|
|
1089
|
+
role: "region",
|
|
1090
|
+
"aria-label": t.reviewTitle
|
|
1091
|
+
}, [
|
|
1092
|
+
V(e.$slots, "review", ae(se(je.value)))
|
|
1093
|
+
], 8, Fa)
|
|
1094
|
+
], 64)) : (o(), f(L, { key: 2 }, [
|
|
1095
|
+
p("div", Ga, [
|
|
1096
|
+
z(le, {
|
|
1097
|
+
icon: b(Qe),
|
|
1098
|
+
label: "Back to search",
|
|
1099
|
+
onClick: Ue
|
|
1100
|
+
}, null, 8, ["icon"]),
|
|
1101
|
+
z(b(Me), {
|
|
1102
|
+
class: "it-palette__chat-mark",
|
|
1103
|
+
size: 16,
|
|
1104
|
+
"aria-hidden": "true"
|
|
1105
|
+
}),
|
|
1106
|
+
p("h2", Ja, C(t.assistantName), 1),
|
|
1107
|
+
z(le, {
|
|
1108
|
+
icon: b(lt),
|
|
1109
|
+
label: "New thread",
|
|
1110
|
+
tooltip: "New thread",
|
|
1111
|
+
disabled: !Ne.value.length,
|
|
1112
|
+
onClick: Ae
|
|
1113
|
+
}, null, 8, ["icon", "disabled"]),
|
|
1114
|
+
z(le, {
|
|
1115
|
+
icon: b(ze),
|
|
1116
|
+
label: "Close",
|
|
1117
|
+
tooltip: !1,
|
|
1118
|
+
onClick: Z
|
|
1119
|
+
}, null, 8, ["icon"])
|
|
1120
|
+
]),
|
|
1121
|
+
z(nt, {
|
|
1122
|
+
ref_key: "thread",
|
|
1123
|
+
ref: H,
|
|
1124
|
+
messages: Ne.value,
|
|
1125
|
+
busy: He.value,
|
|
1126
|
+
placeholder: t.askPlaceholder,
|
|
1127
|
+
navigate: ft,
|
|
1128
|
+
onSend: ut,
|
|
1129
|
+
onStop: Ke,
|
|
1130
|
+
onRetry: ct,
|
|
1131
|
+
onReview: dt
|
|
1132
|
+
}, tt({ _: 2 }, [
|
|
1133
|
+
e.$slots.attachment ? {
|
|
1134
|
+
name: "attachment",
|
|
1135
|
+
fn: U((c) => [
|
|
1136
|
+
V(e.$slots, "attachment", ae(se(c)))
|
|
1137
|
+
]),
|
|
1138
|
+
key: "0"
|
|
1139
|
+
} : void 0,
|
|
1140
|
+
e.$slots.action ? {
|
|
1141
|
+
name: "action",
|
|
1142
|
+
fn: U((c) => [
|
|
1143
|
+
V(e.$slots, "action", ae(se(c)))
|
|
1144
|
+
]),
|
|
1145
|
+
key: "1"
|
|
1146
|
+
} : void 0,
|
|
1147
|
+
e.$slots.error ? {
|
|
1148
|
+
name: "error",
|
|
1149
|
+
fn: U((c) => [
|
|
1150
|
+
V(e.$slots, "error", ae(se(c)))
|
|
1151
|
+
]),
|
|
1152
|
+
key: "2"
|
|
1153
|
+
} : void 0
|
|
1154
|
+
]), 1032, ["messages", "busy", "placeholder"])
|
|
1155
|
+
], 64))
|
|
1156
|
+
]),
|
|
1157
|
+
_: 3
|
|
1158
|
+
}, 8, ["visible", "aria-label", "class", "pt"]));
|
|
1159
|
+
}
|
|
1160
|
+
}), Qa = ["aria-label"], Xa = { class: "it-assistant-panel__head" }, Ya = { class: "it-assistant-panel__titles" }, Za = { class: "it-assistant-panel__title" }, es = {
|
|
1161
|
+
key: 0,
|
|
1162
|
+
class: "it-assistant-panel__status",
|
|
1163
|
+
"aria-live": "polite"
|
|
1164
|
+
}, ts = {
|
|
1165
|
+
key: 0,
|
|
1166
|
+
class: "it-assistant-panel__intro"
|
|
1167
|
+
}, as = { key: 0 }, ss = {
|
|
1168
|
+
key: 1,
|
|
1169
|
+
class: "it-assistant-panel__starters"
|
|
1170
|
+
}, _s = /* @__PURE__ */ ye({
|
|
1171
|
+
__name: "ItAssistantPanel",
|
|
1172
|
+
props: {
|
|
1173
|
+
session: {},
|
|
1174
|
+
title: { default: "Assistant" },
|
|
1175
|
+
status: { default: void 0 },
|
|
1176
|
+
intro: { default: void 0 },
|
|
1177
|
+
starters: { default: () => [] },
|
|
1178
|
+
placeholder: { default: "Ask the assistant…" },
|
|
1179
|
+
closable: { type: Boolean, default: !0 },
|
|
1180
|
+
navigate: { type: Function, default: void 0 }
|
|
1181
|
+
},
|
|
1182
|
+
emits: ["close", "review"],
|
|
1183
|
+
setup(t, { expose: h, emit: _ }) {
|
|
1184
|
+
const n = t, l = _;
|
|
1185
|
+
et(Re, n.session.shown);
|
|
1186
|
+
const m = M(null);
|
|
1187
|
+
function g(y) {
|
|
1188
|
+
var i;
|
|
1189
|
+
n.session.send(y), (i = m.value) == null || i.focus();
|
|
1190
|
+
}
|
|
1191
|
+
return h({ focus: () => {
|
|
1192
|
+
var y;
|
|
1193
|
+
return (y = m.value) == null ? void 0 : y.focus();
|
|
1194
|
+
} }), (y, i) => (o(), f("section", {
|
|
1195
|
+
class: "it-assistant-panel",
|
|
1196
|
+
"aria-label": t.title
|
|
1197
|
+
}, [
|
|
1198
|
+
p("header", Xa, [
|
|
1199
|
+
p("div", Ya, [
|
|
1200
|
+
p("h2", Za, C(t.title), 1),
|
|
1201
|
+
t.status ? (o(), f("p", es, C(t.status), 1)) : S("", !0)
|
|
1202
|
+
]),
|
|
1203
|
+
V(y.$slots, "actions"),
|
|
1204
|
+
z(le, {
|
|
1205
|
+
icon: b(lt),
|
|
1206
|
+
label: "New thread",
|
|
1207
|
+
size: "sm",
|
|
1208
|
+
disabled: !t.session.messages.value.length,
|
|
1209
|
+
onClick: i[0] || (i[0] = (r) => t.session.newThread())
|
|
1210
|
+
}, null, 8, ["icon", "disabled"]),
|
|
1211
|
+
t.closable ? (o(), N(le, {
|
|
1212
|
+
key: 0,
|
|
1213
|
+
icon: b(ze),
|
|
1214
|
+
label: "Close the assistant",
|
|
1215
|
+
tooltip: !1,
|
|
1216
|
+
size: "sm",
|
|
1217
|
+
onClick: i[1] || (i[1] = (r) => l("close"))
|
|
1218
|
+
}, null, 8, ["icon"])) : S("", !0)
|
|
1219
|
+
]),
|
|
1220
|
+
!t.session.messages.value.length && (t.intro || t.starters.length) ? (o(), f("div", ts, [
|
|
1221
|
+
t.intro ? (o(), f("p", as, C(t.intro), 1)) : S("", !0),
|
|
1222
|
+
t.starters.length ? (o(), f("div", ss, [
|
|
1223
|
+
(o(!0), f(L, null, ne(t.starters, (r) => (o(), N(b(me), {
|
|
1224
|
+
key: r.label,
|
|
1225
|
+
label: r.label,
|
|
1226
|
+
severity: "secondary",
|
|
1227
|
+
outlined: "",
|
|
1228
|
+
size: "small",
|
|
1229
|
+
"aria-description": r.prompt,
|
|
1230
|
+
onClick: (u) => g(r.prompt)
|
|
1231
|
+
}, null, 8, ["label", "aria-description", "onClick"]))), 128))
|
|
1232
|
+
])) : S("", !0)
|
|
1233
|
+
])) : S("", !0),
|
|
1234
|
+
z(nt, {
|
|
1235
|
+
ref_key: "thread",
|
|
1236
|
+
ref: m,
|
|
1237
|
+
class: "it-assistant-panel__thread",
|
|
1238
|
+
messages: t.session.messages.value,
|
|
1239
|
+
busy: t.session.busy.value,
|
|
1240
|
+
placeholder: t.placeholder,
|
|
1241
|
+
navigate: t.navigate,
|
|
1242
|
+
onSend: i[2] || (i[2] = (r) => t.session.send(r)),
|
|
1243
|
+
onStop: i[3] || (i[3] = (r) => t.session.stop()),
|
|
1244
|
+
onRetry: i[4] || (i[4] = (r) => t.session.retry()),
|
|
1245
|
+
onReview: i[5] || (i[5] = (r) => l("review", r))
|
|
1246
|
+
}, tt({ _: 2 }, [
|
|
1247
|
+
y.$slots.attachment ? {
|
|
1248
|
+
name: "attachment",
|
|
1249
|
+
fn: U((r) => [
|
|
1250
|
+
V(y.$slots, "attachment", ae(se(r)))
|
|
1251
|
+
]),
|
|
1252
|
+
key: "0"
|
|
1253
|
+
} : void 0,
|
|
1254
|
+
y.$slots.action ? {
|
|
1255
|
+
name: "action",
|
|
1256
|
+
fn: U((r) => [
|
|
1257
|
+
V(y.$slots, "action", ae(se(r)))
|
|
1258
|
+
]),
|
|
1259
|
+
key: "1"
|
|
1260
|
+
} : void 0,
|
|
1261
|
+
y.$slots.error ? {
|
|
1262
|
+
name: "error",
|
|
1263
|
+
fn: U((r) => [
|
|
1264
|
+
V(y.$slots, "error", ae(se(r)))
|
|
1265
|
+
]),
|
|
1266
|
+
key: "2"
|
|
1267
|
+
} : void 0
|
|
1268
|
+
]), 1032, ["messages", "busy", "placeholder", "navigate"])
|
|
1269
|
+
], 8, Qa));
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
export {
|
|
1273
|
+
ra as _,
|
|
1274
|
+
_s as a,
|
|
1275
|
+
nt as b,
|
|
1276
|
+
bs as c,
|
|
1277
|
+
va as d,
|
|
1278
|
+
Ee as h
|
|
1279
|
+
};
|