@infotrust/ui 0.0.0-stage → 0.30.0
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 +92 -3
|
@@ -0,0 +1,1381 @@
|
|
|
1
|
+
var ct = Object.defineProperty;
|
|
2
|
+
var dt = (s, e, t) => e in s ? ct(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var F = (s, e, t) => dt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { defineComponent as ye, computed as L, ref as E, onBeforeUnmount as Oe, openBlock as d, createElementBlock as g, normalizeClass as K, createElementVNode as O, createBlock as re, resolveDynamicComponent as fe, toDisplayString as Be, createCommentVNode as Q, renderSlot as q, createVNode as ce, unref as N, nextTick as Le, watchEffect as J, onMounted as Pe, Fragment as j, renderList as ee, normalizeStyle as V, useAttrs as ft, mergeProps as Ae, withCtx as de, isVNode as Te, watch as pt, normalizeProps as et, createTextVNode as tt } from "vue";
|
|
5
|
+
import { CircleAlert as mt, TriangleAlert as vt, CircleCheck as ht, Info as yt, X as gt } from "lucide-vue-next";
|
|
6
|
+
const bt = { class: "it-callout-frame__fold" }, wt = ["role"], kt = { class: "it-callout__body" }, Tt = { class: "it-callout__content" }, Bt = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "it-callout__title"
|
|
9
|
+
}, Ct = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "it-callout__text"
|
|
12
|
+
}, Et = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "it-callout__actions"
|
|
15
|
+
}, St = 'a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', _s = /* @__PURE__ */ ye({
|
|
16
|
+
__name: "ItCallout",
|
|
17
|
+
props: {
|
|
18
|
+
tone: { default: "info" },
|
|
19
|
+
title: {},
|
|
20
|
+
closable: { type: Boolean }
|
|
21
|
+
},
|
|
22
|
+
emits: ["close"],
|
|
23
|
+
setup(s, { emit: e }) {
|
|
24
|
+
const t = s, i = e, a = L(() => ({ info: yt, success: ht, warning: vt, danger: mt })[t.tone]), h = E(null), p = E(!1), k = E(!1);
|
|
25
|
+
let l, r = null, m = null;
|
|
26
|
+
function _(u) {
|
|
27
|
+
return Array.from(document.querySelectorAll(St)).find((D) => !u.contains(D) && !!(u.compareDocumentPosition(D) & Node.DOCUMENT_POSITION_FOLLOWING)) ?? null;
|
|
28
|
+
}
|
|
29
|
+
function B(u) {
|
|
30
|
+
if (!u) return 0;
|
|
31
|
+
const $ = getComputedStyle(u);
|
|
32
|
+
return ($.display.includes("grid") || $.display.includes("flex") && $.flexDirection.startsWith("column")) && parseFloat($.rowGap) || 0;
|
|
33
|
+
}
|
|
34
|
+
function c() {
|
|
35
|
+
let u = h.value;
|
|
36
|
+
for (; u != null && u.parentElement && u.parentElement.childElementCount === 1 && !B(u.parentElement); ) u = u.parentElement;
|
|
37
|
+
const $ = B((u == null ? void 0 : u.parentElement) ?? null);
|
|
38
|
+
if (!u || !$) return;
|
|
39
|
+
r = { item: u, transition: u.style.transition, marginBottom: u.style.marginBottom };
|
|
40
|
+
const D = getComputedStyle(u).transition, U = "margin-bottom var(--it-duration-slow) var(--it-ease-exit) var(--it-duration-fast)";
|
|
41
|
+
u.style.transition = D && !/^all 0s/.test(D) ? `${D}, ${U}` : U, requestAnimationFrame(() => {
|
|
42
|
+
u && (u.style.marginBottom = `-${$}px`);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function b() {
|
|
46
|
+
r != null && r.item.isConnected && r.item !== h.value && (r.item.style.transition = r.transition, r.item.style.marginBottom = r.marginBottom), r = null;
|
|
47
|
+
}
|
|
48
|
+
function w() {
|
|
49
|
+
k.value || (clearTimeout(l), k.value = !0, i("close"), Le(() => {
|
|
50
|
+
b(), m == null || m.focus({ preventScroll: !0 }), m = null;
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
function x() {
|
|
54
|
+
var $;
|
|
55
|
+
if (p.value) return;
|
|
56
|
+
if (($ = h.value) != null && $.contains(document.activeElement) && (m = _(h.value)), typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
57
|
+
w();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
p.value = !0, c(), l = setTimeout(w, 600);
|
|
61
|
+
}
|
|
62
|
+
function H(u) {
|
|
63
|
+
u.target === u.currentTarget && u.propertyName === "grid-template-rows" && w();
|
|
64
|
+
}
|
|
65
|
+
return Oe(() => {
|
|
66
|
+
clearTimeout(l), b();
|
|
67
|
+
}), (u, $) => k.value ? Q("", !0) : (d(), g("div", {
|
|
68
|
+
key: 0,
|
|
69
|
+
ref_key: "frame",
|
|
70
|
+
ref: h,
|
|
71
|
+
class: K(["it-callout-frame", { "it-callout-frame--leaving": p.value }]),
|
|
72
|
+
onTransitionend: H
|
|
73
|
+
}, [
|
|
74
|
+
O("div", bt, [
|
|
75
|
+
O("div", {
|
|
76
|
+
class: K(["it-callout", `it-callout--${s.tone}`]),
|
|
77
|
+
role: s.tone === "danger" ? "alert" : "status"
|
|
78
|
+
}, [
|
|
79
|
+
(d(), re(fe(a.value), {
|
|
80
|
+
class: "it-callout__icon",
|
|
81
|
+
size: 16,
|
|
82
|
+
"aria-hidden": "true"
|
|
83
|
+
})),
|
|
84
|
+
O("div", kt, [
|
|
85
|
+
O("p", Tt, [
|
|
86
|
+
s.title ? (d(), g("strong", Bt, Be(s.title), 1)) : Q("", !0),
|
|
87
|
+
u.$slots.default ? (d(), g("span", Ct, [
|
|
88
|
+
q(u.$slots, "default")
|
|
89
|
+
])) : Q("", !0)
|
|
90
|
+
])
|
|
91
|
+
]),
|
|
92
|
+
u.$slots.actions ? (d(), g("div", Et, [
|
|
93
|
+
q(u.$slots, "actions")
|
|
94
|
+
])) : Q("", !0),
|
|
95
|
+
s.closable ? (d(), g("button", {
|
|
96
|
+
key: 1,
|
|
97
|
+
type: "button",
|
|
98
|
+
class: "it-callout__close",
|
|
99
|
+
"aria-label": "Dismiss",
|
|
100
|
+
onClick: x
|
|
101
|
+
}, [
|
|
102
|
+
ce(N(gt), {
|
|
103
|
+
size: 14,
|
|
104
|
+
"aria-hidden": "true"
|
|
105
|
+
})
|
|
106
|
+
])) : Q("", !0)
|
|
107
|
+
], 10, wt)
|
|
108
|
+
])
|
|
109
|
+
], 34));
|
|
110
|
+
}
|
|
111
|
+
}), Dt = { class: "it-skeleton__cell it-skeleton__cell--stack" }, $t = { class: "it-skeleton__cell it-skeleton__cell--stack" }, Ps = /* @__PURE__ */ ye({
|
|
112
|
+
__name: "ItSkeleton",
|
|
113
|
+
props: {
|
|
114
|
+
kind: { default: "text" },
|
|
115
|
+
rows: { default: 3 },
|
|
116
|
+
columns: { default: 4 },
|
|
117
|
+
height: {},
|
|
118
|
+
width: {}
|
|
119
|
+
},
|
|
120
|
+
setup(s) {
|
|
121
|
+
const e = s;
|
|
122
|
+
J(() => {
|
|
123
|
+
});
|
|
124
|
+
const t = ["72%", "58%", "66%", "46%", "62%"], i = ["44%", "34%"], a = ["70%", "55%", "80%", "60%"], h = ["92%", "78%", "85%", "64%"], p = E(null), k = E(null);
|
|
125
|
+
let l;
|
|
126
|
+
function r() {
|
|
127
|
+
var b, w;
|
|
128
|
+
const B = (b = p.value) == null ? void 0 : b.closest("td");
|
|
129
|
+
if (!B) return [];
|
|
130
|
+
const c = (w = B.closest("table")) == null ? void 0 : w.querySelectorAll(":scope > thead > tr");
|
|
131
|
+
return (c == null ? void 0 : c.length) === 1 ? [...c[0].querySelectorAll(":scope > th")] : [];
|
|
132
|
+
}
|
|
133
|
+
function m() {
|
|
134
|
+
var $;
|
|
135
|
+
const c = r().filter((D) => getComputedStyle(D).display !== "none"), b = ($ = p.value) == null ? void 0 : $.closest("td");
|
|
136
|
+
b && c.length && b.colSpan !== c.length && (b.colSpan = c.length);
|
|
137
|
+
let w = !1;
|
|
138
|
+
const x = c.map((D) => ({ th: D, width: D.getBoundingClientRect().width })).filter(({ width: D }) => D >= 1).map(({ th: D, width: U }) => D.classList.contains("it-cell-actions") || D.querySelector('input[type="checkbox"]') ? { width: U, kind: "control" } : D.classList.contains("it-num") ? { width: U, kind: "num" } : w ? { width: U, kind: "text" } : (w = !0, { width: U, kind: "primary" })), H = k.value;
|
|
139
|
+
(H == null ? void 0 : H.length) === x.length && H.every((D, U) => D.width === x[U].width && D.kind === x[U].kind) || (k.value = x.length ? x : null);
|
|
140
|
+
}
|
|
141
|
+
Pe(() => {
|
|
142
|
+
if (e.kind !== "table") return;
|
|
143
|
+
const B = r();
|
|
144
|
+
if (B.length && (m(), !(typeof ResizeObserver > "u"))) {
|
|
145
|
+
l = new ResizeObserver(m);
|
|
146
|
+
for (const c of B) l.observe(c);
|
|
147
|
+
}
|
|
148
|
+
}), Oe(() => l == null ? void 0 : l.disconnect());
|
|
149
|
+
const _ = (B) => B.map((c) => `minmax(0, ${c.width}px)`).join(" ");
|
|
150
|
+
return (B, c) => (d(), g("div", {
|
|
151
|
+
ref_key: "root",
|
|
152
|
+
ref: p,
|
|
153
|
+
class: K(["it-skeleton", `it-skeleton--${s.kind}`]),
|
|
154
|
+
role: "status",
|
|
155
|
+
"aria-live": "polite",
|
|
156
|
+
"aria-label": "Loading"
|
|
157
|
+
}, [
|
|
158
|
+
s.kind === "table" && k.value ? (d(!0), g(j, { key: 0 }, ee(s.rows, (b) => (d(), g("div", {
|
|
159
|
+
key: b,
|
|
160
|
+
class: "it-skeleton__row it-skeleton__row--columns",
|
|
161
|
+
style: V({ gridTemplateColumns: _(k.value) })
|
|
162
|
+
}, [
|
|
163
|
+
(d(!0), g(j, null, ee(k.value, (w, x) => (d(), g("span", {
|
|
164
|
+
key: x,
|
|
165
|
+
class: K(["it-skeleton__cell", { "it-skeleton__cell--stack": w.kind === "primary", "it-skeleton__cell--end": w.kind === "num" }])
|
|
166
|
+
}, [
|
|
167
|
+
w.kind === "primary" ? (d(), g(j, { key: 0 }, [
|
|
168
|
+
O("span", {
|
|
169
|
+
class: "it-skeleton__bar",
|
|
170
|
+
style: V({ width: t[(b - 1) % t.length] })
|
|
171
|
+
}, null, 4),
|
|
172
|
+
O("span", {
|
|
173
|
+
class: "it-skeleton__bar it-skeleton__bar--sub",
|
|
174
|
+
style: V({ width: i[(b - 1) % i.length] })
|
|
175
|
+
}, null, 4)
|
|
176
|
+
], 64)) : w.kind !== "control" ? (d(), g("span", {
|
|
177
|
+
key: 1,
|
|
178
|
+
class: "it-skeleton__bar",
|
|
179
|
+
style: V({ width: a[(b + x) % a.length] })
|
|
180
|
+
}, null, 4)) : Q("", !0)
|
|
181
|
+
], 2))), 128))
|
|
182
|
+
], 4))), 128)) : s.kind === "table" ? (d(!0), g(j, { key: 1 }, ee(s.rows, (b) => (d(), g("div", {
|
|
183
|
+
key: b,
|
|
184
|
+
class: "it-skeleton__row",
|
|
185
|
+
style: V({ gridTemplateColumns: `minmax(10rem, 2fr) repeat(${Math.max(s.columns - 1, 0)}, minmax(5rem, 1fr))` })
|
|
186
|
+
}, [
|
|
187
|
+
O("span", Dt, [
|
|
188
|
+
O("span", {
|
|
189
|
+
class: "it-skeleton__bar",
|
|
190
|
+
style: V({ width: t[(b - 1) % t.length] })
|
|
191
|
+
}, null, 4),
|
|
192
|
+
O("span", {
|
|
193
|
+
class: "it-skeleton__bar it-skeleton__bar--sub",
|
|
194
|
+
style: V({ width: i[(b - 1) % i.length] })
|
|
195
|
+
}, null, 4)
|
|
196
|
+
]),
|
|
197
|
+
(d(!0), g(j, null, ee(s.columns - 1, (w) => (d(), g("span", {
|
|
198
|
+
key: w,
|
|
199
|
+
class: "it-skeleton__cell"
|
|
200
|
+
}, [
|
|
201
|
+
O("span", {
|
|
202
|
+
class: "it-skeleton__bar",
|
|
203
|
+
style: V({ width: a[(b + w) % a.length] })
|
|
204
|
+
}, null, 4)
|
|
205
|
+
]))), 128))
|
|
206
|
+
], 4))), 128)) : s.kind === "text" ? (d(!0), g(j, { key: 2 }, ee(s.rows, (b) => (d(), g("span", {
|
|
207
|
+
key: b,
|
|
208
|
+
class: "it-skeleton__bar",
|
|
209
|
+
style: V({ width: h[b % h.length] })
|
|
210
|
+
}, null, 4))), 128)) : s.kind === "list" ? (d(!0), g(j, { key: 3 }, ee(s.rows, (b) => (d(), g("div", {
|
|
211
|
+
key: b,
|
|
212
|
+
class: "it-skeleton__item"
|
|
213
|
+
}, [
|
|
214
|
+
c[0] || (c[0] = O("span", { class: "it-skeleton__bar it-skeleton__icon" }, null, -1)),
|
|
215
|
+
O("span", $t, [
|
|
216
|
+
O("span", {
|
|
217
|
+
class: "it-skeleton__bar",
|
|
218
|
+
style: V({ width: t[(b - 1) % t.length] })
|
|
219
|
+
}, null, 4),
|
|
220
|
+
O("span", {
|
|
221
|
+
class: "it-skeleton__bar it-skeleton__bar--sub",
|
|
222
|
+
style: V({ width: h[b % h.length] })
|
|
223
|
+
}, null, 4)
|
|
224
|
+
])
|
|
225
|
+
]))), 128)) : (d(), g("span", {
|
|
226
|
+
key: 4,
|
|
227
|
+
class: "it-skeleton__bar",
|
|
228
|
+
style: V({ height: s.height ?? "12px", width: s.width })
|
|
229
|
+
}, null, 4))
|
|
230
|
+
], 2));
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
function It(s) {
|
|
234
|
+
for (let t = s.parentElement; t; t = t.parentElement)
|
|
235
|
+
if (/^(auto|scroll|overlay)$/.test(getComputedStyle(t).overflowY)) return t;
|
|
236
|
+
const e = document.scrollingElement;
|
|
237
|
+
return e && !/^(hidden|clip)$/.test(getComputedStyle(e).overflowY) ? e : null;
|
|
238
|
+
}
|
|
239
|
+
function As(s, { container: e = It(s), block: t = "nearest", behavior: i = "instant" } = {}) {
|
|
240
|
+
if (!e) return;
|
|
241
|
+
const a = e === document.scrollingElement, h = a ? window.innerHeight : e.clientHeight, p = a ? 0 : e.getBoundingClientRect().top + e.clientTop, k = s.getBoundingClientRect(), l = getComputedStyle(e), r = getComputedStyle(s), m = k.top - p - (parseFloat(r.scrollMarginTop) || 0) - (parseFloat(l.scrollPaddingTop) || 0), _ = k.bottom - p + (parseFloat(r.scrollMarginBottom) || 0) - h + (parseFloat(l.scrollPaddingBottom) || 0);
|
|
242
|
+
let B = m;
|
|
243
|
+
t === "center" && (B = (m + _) / 2), t === "nearest" && (B = m < 0 && _ > 0 ? 0 : m < 0 ? m : _ > 0 ? _ : 0), e.scrollTo({ top: Math.max(0, Math.min(e.scrollTop + B, e.scrollHeight - h)), behavior: i });
|
|
244
|
+
}
|
|
245
|
+
let xe = 1;
|
|
246
|
+
var _t = class {
|
|
247
|
+
constructor() {
|
|
248
|
+
F(this, "subscribers");
|
|
249
|
+
F(this, "toasts");
|
|
250
|
+
F(this, "dismissedToasts");
|
|
251
|
+
F(this, "subscribe", (s) => (this.subscribers.push(s), () => {
|
|
252
|
+
const e = this.subscribers.indexOf(s);
|
|
253
|
+
this.subscribers.splice(e, 1);
|
|
254
|
+
}));
|
|
255
|
+
F(this, "publish", (s) => {
|
|
256
|
+
this.subscribers.forEach((e) => e(s));
|
|
257
|
+
});
|
|
258
|
+
F(this, "addToast", (s) => {
|
|
259
|
+
this.publish(s), this.toasts = [...this.toasts, s];
|
|
260
|
+
});
|
|
261
|
+
F(this, "create", (s) => {
|
|
262
|
+
var p;
|
|
263
|
+
const { message: e, ...t } = s, i = typeof s.id == "number" || s.id && ((p = s.id) == null ? void 0 : p.length) > 0 ? s.id : xe++, a = this.toasts.find((k) => k.id === i), h = s.dismissible === void 0 ? !0 : s.dismissible;
|
|
264
|
+
return this.dismissedToasts.has(i) && this.dismissedToasts.delete(i), a ? this.toasts = this.toasts.map((k) => k.id === i ? (this.publish({
|
|
265
|
+
...k,
|
|
266
|
+
...s,
|
|
267
|
+
id: i,
|
|
268
|
+
title: e
|
|
269
|
+
}), {
|
|
270
|
+
...k,
|
|
271
|
+
...s,
|
|
272
|
+
id: i,
|
|
273
|
+
dismissible: h,
|
|
274
|
+
title: e
|
|
275
|
+
}) : k) : this.addToast({
|
|
276
|
+
title: e,
|
|
277
|
+
...t,
|
|
278
|
+
dismissible: h,
|
|
279
|
+
id: i
|
|
280
|
+
}), i;
|
|
281
|
+
});
|
|
282
|
+
F(this, "dismiss", (s) => (s ? (this.dismissedToasts.add(s), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
|
|
283
|
+
id: s,
|
|
284
|
+
dismiss: !0
|
|
285
|
+
})))) : this.toasts.forEach((e) => {
|
|
286
|
+
this.subscribers.forEach((t) => t({
|
|
287
|
+
id: e.id,
|
|
288
|
+
dismiss: !0
|
|
289
|
+
}));
|
|
290
|
+
}), s));
|
|
291
|
+
F(this, "message", (s, e) => this.create({
|
|
292
|
+
...e,
|
|
293
|
+
message: s,
|
|
294
|
+
type: "default"
|
|
295
|
+
}));
|
|
296
|
+
F(this, "error", (s, e) => this.create({
|
|
297
|
+
...e,
|
|
298
|
+
type: "error",
|
|
299
|
+
message: s
|
|
300
|
+
}));
|
|
301
|
+
F(this, "success", (s, e) => this.create({
|
|
302
|
+
...e,
|
|
303
|
+
type: "success",
|
|
304
|
+
message: s
|
|
305
|
+
}));
|
|
306
|
+
F(this, "info", (s, e) => this.create({
|
|
307
|
+
...e,
|
|
308
|
+
type: "info",
|
|
309
|
+
message: s
|
|
310
|
+
}));
|
|
311
|
+
F(this, "warning", (s, e) => this.create({
|
|
312
|
+
...e,
|
|
313
|
+
type: "warning",
|
|
314
|
+
message: s
|
|
315
|
+
}));
|
|
316
|
+
F(this, "loading", (s, e) => this.create({
|
|
317
|
+
...e,
|
|
318
|
+
type: "loading",
|
|
319
|
+
message: s
|
|
320
|
+
}));
|
|
321
|
+
F(this, "promise", (s, e) => {
|
|
322
|
+
if (!e) return;
|
|
323
|
+
let t;
|
|
324
|
+
e.loading !== void 0 && (t = this.create({
|
|
325
|
+
...e,
|
|
326
|
+
promise: s,
|
|
327
|
+
type: "loading",
|
|
328
|
+
message: e.loading,
|
|
329
|
+
description: typeof e.description != "function" ? e.description : void 0
|
|
330
|
+
}));
|
|
331
|
+
const i = Promise.resolve(s instanceof Function ? s() : s);
|
|
332
|
+
let a = t !== void 0, h;
|
|
333
|
+
const p = i.then(async (l) => {
|
|
334
|
+
if (h = ["resolve", l], Te(l))
|
|
335
|
+
a = !1, this.create({
|
|
336
|
+
id: t,
|
|
337
|
+
type: "default",
|
|
338
|
+
message: l
|
|
339
|
+
});
|
|
340
|
+
else if (At(l) && !l.ok) {
|
|
341
|
+
a = !1;
|
|
342
|
+
const m = typeof e.error == "function" ? await e.error(`HTTP error! status: ${l.status}`) : e.error, _ = typeof e.description == "function" ? await e.description(`HTTP error! status: ${l.status}`) : e.description, c = typeof m == "object" && !Te(m) ? m : {
|
|
343
|
+
message: m || "",
|
|
344
|
+
id: t || ""
|
|
345
|
+
};
|
|
346
|
+
this.create({
|
|
347
|
+
id: t,
|
|
348
|
+
type: "error",
|
|
349
|
+
description: _,
|
|
350
|
+
...c
|
|
351
|
+
});
|
|
352
|
+
} else if (l instanceof Error) {
|
|
353
|
+
a = !1;
|
|
354
|
+
const m = typeof e.error == "function" ? await e.error(l) : e.error, _ = typeof e.description == "function" ? await e.description(l) : e.description, c = typeof m == "object" && !Te(m) ? m : {
|
|
355
|
+
message: m || "",
|
|
356
|
+
id: t || ""
|
|
357
|
+
};
|
|
358
|
+
this.create({
|
|
359
|
+
id: t,
|
|
360
|
+
type: "error",
|
|
361
|
+
description: _,
|
|
362
|
+
...c
|
|
363
|
+
});
|
|
364
|
+
} else if (e.success !== void 0) {
|
|
365
|
+
a = !1;
|
|
366
|
+
const m = typeof e.success == "function" ? await e.success(l) : e.success, _ = typeof e.description == "function" ? await e.description(l) : e.description, c = typeof m == "object" && !Te(m) ? m : {
|
|
367
|
+
message: m || "",
|
|
368
|
+
id: t || ""
|
|
369
|
+
};
|
|
370
|
+
this.create({
|
|
371
|
+
id: t,
|
|
372
|
+
type: "success",
|
|
373
|
+
description: _,
|
|
374
|
+
...c
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}).catch(async (l) => {
|
|
378
|
+
if (h = ["reject", l], e.error !== void 0) {
|
|
379
|
+
a = !1;
|
|
380
|
+
const r = typeof e.error == "function" ? await e.error(l) : e.error, m = typeof e.description == "function" ? await e.description(l) : e.description, B = typeof r == "object" && !Te(r) ? r : {
|
|
381
|
+
message: r || "",
|
|
382
|
+
id: t || ""
|
|
383
|
+
};
|
|
384
|
+
this.create({
|
|
385
|
+
id: t,
|
|
386
|
+
type: "error",
|
|
387
|
+
description: m,
|
|
388
|
+
...B
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}).finally(() => {
|
|
392
|
+
var l;
|
|
393
|
+
a && (this.dismiss(t), t = void 0), (l = e.finally) == null || l.call(e);
|
|
394
|
+
}), k = () => new Promise((l, r) => p.then(() => h[0] === "reject" ? r(h[1]) : l(h[1])).catch(r));
|
|
395
|
+
return typeof t != "string" && typeof t != "number" ? { unwrap: k } : Object.assign(t, { unwrap: k });
|
|
396
|
+
});
|
|
397
|
+
F(this, "custom", (s, e) => {
|
|
398
|
+
const t = (e == null ? void 0 : e.id) || xe++, i = this.toasts.find((h) => h.id === t), a = (e == null ? void 0 : e.dismissible) === void 0 ? !0 : e.dismissible;
|
|
399
|
+
return this.dismissedToasts.has(t) && this.dismissedToasts.delete(t), i ? this.toasts = this.toasts.map((h) => h.id === t ? (this.publish({
|
|
400
|
+
...h,
|
|
401
|
+
component: s,
|
|
402
|
+
dismissible: a,
|
|
403
|
+
id: t,
|
|
404
|
+
...e
|
|
405
|
+
}), {
|
|
406
|
+
...h,
|
|
407
|
+
component: s,
|
|
408
|
+
dismissible: a,
|
|
409
|
+
id: t,
|
|
410
|
+
...e
|
|
411
|
+
}) : h) : this.addToast({
|
|
412
|
+
component: s,
|
|
413
|
+
dismissible: a,
|
|
414
|
+
id: t,
|
|
415
|
+
...e
|
|
416
|
+
}), t;
|
|
417
|
+
});
|
|
418
|
+
F(this, "getActiveToasts", () => this.toasts.filter((s) => !this.dismissedToasts.has(s.id)));
|
|
419
|
+
this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
const Y = new _t();
|
|
423
|
+
function Pt(s, e) {
|
|
424
|
+
const t = (e == null ? void 0 : e.id) || xe++;
|
|
425
|
+
return Y.create({
|
|
426
|
+
message: s,
|
|
427
|
+
id: t,
|
|
428
|
+
type: "default",
|
|
429
|
+
...e
|
|
430
|
+
}), t;
|
|
431
|
+
}
|
|
432
|
+
const At = (s) => s && typeof s == "object" && "ok" in s && typeof s.ok == "boolean" && "status" in s && typeof s.status == "number", Ot = Pt, Mt = () => Y.toasts, xt = () => Y.getActiveToasts(), He = Object.assign(Ot, {
|
|
433
|
+
success: Y.success,
|
|
434
|
+
info: Y.info,
|
|
435
|
+
warning: Y.warning,
|
|
436
|
+
error: Y.error,
|
|
437
|
+
custom: Y.custom,
|
|
438
|
+
message: Y.message,
|
|
439
|
+
promise: Y.promise,
|
|
440
|
+
dismiss: Y.dismiss,
|
|
441
|
+
loading: Y.loading
|
|
442
|
+
}, {
|
|
443
|
+
getHistory: Mt,
|
|
444
|
+
getToasts: xt
|
|
445
|
+
});
|
|
446
|
+
function Ie(s) {
|
|
447
|
+
return s.label !== void 0;
|
|
448
|
+
}
|
|
449
|
+
const Ht = 3, nt = "24px", it = "16px", st = 4e3, Lt = 356, Rt = 14, Nt = 45, at = 200;
|
|
450
|
+
function zt() {
|
|
451
|
+
const s = E(!1);
|
|
452
|
+
return J(() => {
|
|
453
|
+
const e = () => {
|
|
454
|
+
s.value = document.hidden;
|
|
455
|
+
};
|
|
456
|
+
return document.addEventListener("visibilitychange", e), () => window.removeEventListener("visibilitychange", e);
|
|
457
|
+
}), { isDocumentHidden: s };
|
|
458
|
+
}
|
|
459
|
+
function le(...s) {
|
|
460
|
+
return s.filter(Boolean).join(" ");
|
|
461
|
+
}
|
|
462
|
+
function Ft(s) {
|
|
463
|
+
const [e, t] = s.split("-"), i = [];
|
|
464
|
+
return e && i.push(e), t && i.push(t), i;
|
|
465
|
+
}
|
|
466
|
+
function Ut(s, e) {
|
|
467
|
+
const t = {};
|
|
468
|
+
return [s, e].forEach((i, a) => {
|
|
469
|
+
const h = a === 1, p = h ? "--mobile-offset" : "--offset", k = h ? it : nt;
|
|
470
|
+
function l(r) {
|
|
471
|
+
[
|
|
472
|
+
"top",
|
|
473
|
+
"right",
|
|
474
|
+
"bottom",
|
|
475
|
+
"left"
|
|
476
|
+
].forEach((m) => {
|
|
477
|
+
t[`${p}-${m}`] = typeof r == "number" ? `${r}px` : r;
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
typeof i == "number" || typeof i == "string" ? l(i) : typeof i == "object" ? [
|
|
481
|
+
"top",
|
|
482
|
+
"right",
|
|
483
|
+
"bottom",
|
|
484
|
+
"left"
|
|
485
|
+
].forEach((r) => {
|
|
486
|
+
i[r] === void 0 ? t[`${p}-${r}`] = k : t[`${p}-${r}`] = typeof i[r] == "number" ? `${i[r]}px` : i[r];
|
|
487
|
+
}) : l(k);
|
|
488
|
+
}), t;
|
|
489
|
+
}
|
|
490
|
+
const Wt = [
|
|
491
|
+
"data-rich-colors",
|
|
492
|
+
"data-styled",
|
|
493
|
+
"data-mounted",
|
|
494
|
+
"data-promise",
|
|
495
|
+
"data-swiped",
|
|
496
|
+
"data-removed",
|
|
497
|
+
"data-visible",
|
|
498
|
+
"data-y-position",
|
|
499
|
+
"data-x-position",
|
|
500
|
+
"data-index",
|
|
501
|
+
"data-front",
|
|
502
|
+
"data-swiping",
|
|
503
|
+
"data-dismissible",
|
|
504
|
+
"data-type",
|
|
505
|
+
"data-invert",
|
|
506
|
+
"data-swipe-out",
|
|
507
|
+
"data-swipe-direction",
|
|
508
|
+
"data-expanded",
|
|
509
|
+
"data-testid"
|
|
510
|
+
], Vt = [
|
|
511
|
+
"aria-label",
|
|
512
|
+
"data-disabled",
|
|
513
|
+
"data-close-button-position"
|
|
514
|
+
];
|
|
515
|
+
var jt = /* @__PURE__ */ ye({
|
|
516
|
+
__name: "Toast",
|
|
517
|
+
props: {
|
|
518
|
+
toast: {},
|
|
519
|
+
toasts: {},
|
|
520
|
+
index: {},
|
|
521
|
+
swipeDirections: {},
|
|
522
|
+
expanded: { type: Boolean },
|
|
523
|
+
invert: { type: Boolean },
|
|
524
|
+
heights: {},
|
|
525
|
+
gap: {},
|
|
526
|
+
position: {},
|
|
527
|
+
closeButtonPosition: {},
|
|
528
|
+
visibleToasts: {},
|
|
529
|
+
expandByDefault: { type: Boolean },
|
|
530
|
+
closeButton: { type: Boolean },
|
|
531
|
+
interacting: { type: Boolean },
|
|
532
|
+
style: {},
|
|
533
|
+
cancelButtonStyle: {},
|
|
534
|
+
actionButtonStyle: {},
|
|
535
|
+
duration: {},
|
|
536
|
+
class: {},
|
|
537
|
+
unstyled: { type: Boolean },
|
|
538
|
+
descriptionClass: {},
|
|
539
|
+
loadingIcon: {},
|
|
540
|
+
classes: {},
|
|
541
|
+
icons: {},
|
|
542
|
+
closeButtonAriaLabel: {},
|
|
543
|
+
defaultRichColors: { type: Boolean }
|
|
544
|
+
},
|
|
545
|
+
emits: [
|
|
546
|
+
"update:heights",
|
|
547
|
+
"update:height",
|
|
548
|
+
"removeToast"
|
|
549
|
+
],
|
|
550
|
+
setup(s, { emit: e }) {
|
|
551
|
+
const t = s, i = e, a = E(null), h = E(null), p = E(!1), k = E(!1), l = E(!1), r = E(!1), m = E(!1), _ = E(0), B = E(0), c = E(t.toast.duration || t.duration || st), b = E(null), w = E(null), x = L(() => t.index === 0), H = L(() => t.index + 1 <= t.visibleToasts), u = L(() => t.toast.type), $ = L(() => t.toast.dismissible !== !1), D = L(() => t.toast.class || ""), U = L(() => t.descriptionClass || ""), pe = L(() => {
|
|
552
|
+
const o = t.toast.position || t.position, C = t.heights.filter((I) => I.position === o).findIndex((I) => I.toastId === t.toast.id);
|
|
553
|
+
return C >= 0 ? C : 0;
|
|
554
|
+
}), T = L(() => {
|
|
555
|
+
const o = t.toast.position || t.position;
|
|
556
|
+
return t.heights.filter((C) => C.position === o).reduce((C, I, M) => M >= pe.value ? C : C + I.height, 0);
|
|
557
|
+
}), v = L(() => pe.value * t.gap + T.value || 0), S = L(() => t.toast.closeButton ?? t.closeButton), n = L(() => t.toast.duration || t.duration || st), y = E(0), f = E(0), P = E(null), z = L(() => t.position.split("-")), ue = L(() => z.value[0]), X = L(() => z.value[1]), Ee = L(() => typeof t.toast.title != "string"), Se = L(() => typeof t.toast.description != "string"), { isDocumentHidden: ge } = zt(), me = L(() => u.value && u.value === "loading");
|
|
558
|
+
Pe(() => {
|
|
559
|
+
p.value = !0, c.value = n.value;
|
|
560
|
+
});
|
|
561
|
+
let W, te, ve = !1;
|
|
562
|
+
function he() {
|
|
563
|
+
const o = w.value;
|
|
564
|
+
if (!o || ve || k.value) return;
|
|
565
|
+
const A = o.style.height;
|
|
566
|
+
o.style.height = "auto";
|
|
567
|
+
const C = o.offsetHeight;
|
|
568
|
+
o.style.height = A, C !== B.value && (B.value = C, i("update:height", {
|
|
569
|
+
toastId: t.toast.id,
|
|
570
|
+
height: C,
|
|
571
|
+
position: t.toast.position || t.position
|
|
572
|
+
}));
|
|
573
|
+
}
|
|
574
|
+
Pe(async () => {
|
|
575
|
+
await Le();
|
|
576
|
+
const o = w.value;
|
|
577
|
+
if (!o || ve) return;
|
|
578
|
+
he();
|
|
579
|
+
let A = o.clientWidth;
|
|
580
|
+
typeof ResizeObserver < "u" && (W = new ResizeObserver((I) => {
|
|
581
|
+
const M = o.clientWidth;
|
|
582
|
+
(M !== A || I.some((R) => R.target !== o)) && (A = M, he());
|
|
583
|
+
}));
|
|
584
|
+
const C = () => {
|
|
585
|
+
W == null || W.disconnect(), W == null || W.observe(o), Array.from(o.children).forEach((I) => W == null ? void 0 : W.observe(I)), he();
|
|
586
|
+
};
|
|
587
|
+
C(), te = new MutationObserver(C), te.observe(o, { childList: !0, characterData: !0, subtree: !0 });
|
|
588
|
+
}), Oe(() => {
|
|
589
|
+
ve = !0, W == null || W.disconnect(), te == null || te.disconnect();
|
|
590
|
+
});
|
|
591
|
+
function Z() {
|
|
592
|
+
k.value = !0, _.value = v.value, setTimeout(() => {
|
|
593
|
+
i("removeToast", t.toast);
|
|
594
|
+
}, at);
|
|
595
|
+
}
|
|
596
|
+
function be() {
|
|
597
|
+
var o, A;
|
|
598
|
+
if (me.value || !$.value) return {};
|
|
599
|
+
Z(), (A = (o = t.toast).onDismiss) == null || A.call(o, t.toast);
|
|
600
|
+
}
|
|
601
|
+
function De(o) {
|
|
602
|
+
o.button !== 2 && (me.value || !$.value || (b.value = /* @__PURE__ */ new Date(), _.value = v.value, o.target.setPointerCapture(o.pointerId), o.target.tagName !== "BUTTON" && (l.value = !0, P.value = {
|
|
603
|
+
x: o.clientX,
|
|
604
|
+
y: o.clientY
|
|
605
|
+
})));
|
|
606
|
+
}
|
|
607
|
+
function lt() {
|
|
608
|
+
var R, se, oe, ne, ie, ae, G;
|
|
609
|
+
if (r.value || !$.value) return;
|
|
610
|
+
P.value = null;
|
|
611
|
+
const o = Number(((R = w.value) == null ? void 0 : R.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), A = Number(((se = w.value) == null ? void 0 : se.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), C = (/* @__PURE__ */ new Date()).getTime() - (((oe = b.value) == null ? void 0 : oe.getTime()) || 0), I = a.value === "x" ? o : A, M = Math.abs(I) / C;
|
|
612
|
+
if (Math.abs(I) >= Nt || M > 0.11) {
|
|
613
|
+
_.value = v.value, (ie = (ne = t.toast).onDismiss) == null || ie.call(ne, t.toast), a.value === "x" ? h.value = o > 0 ? "right" : "left" : h.value = A > 0 ? "down" : "up", Z(), r.value = !0;
|
|
614
|
+
return;
|
|
615
|
+
} else
|
|
616
|
+
(ae = w.value) == null || ae.style.setProperty("--swipe-amount-x", "0px"), (G = w.value) == null || G.style.setProperty("--swipe-amount-y", "0px");
|
|
617
|
+
m.value = !1, l.value = !1, a.value = null;
|
|
618
|
+
}
|
|
619
|
+
function rt(o) {
|
|
620
|
+
var oe, ne, ie, ae;
|
|
621
|
+
if (!P.value || !$.value || (((ne = (oe = window == null ? void 0 : window.getSelection()) == null ? void 0 : oe.toString()) == null ? void 0 : ne.length) ?? !1)) return;
|
|
622
|
+
const C = o.clientY - P.value.y, I = o.clientX - P.value.x, M = t.swipeDirections ?? Ft(t.position);
|
|
623
|
+
!a.value && (Math.abs(I) > 1 || Math.abs(C) > 1) && (a.value = Math.abs(I) > Math.abs(C) ? "x" : "y");
|
|
624
|
+
let R = {
|
|
625
|
+
x: 0,
|
|
626
|
+
y: 0
|
|
627
|
+
};
|
|
628
|
+
const se = (G) => 1 / (1.5 + Math.abs(G) / 20);
|
|
629
|
+
if (a.value === "y") {
|
|
630
|
+
if (M.includes("top") || M.includes("bottom")) if (M.includes("top") && C < 0 || M.includes("bottom") && C > 0) R.y = C;
|
|
631
|
+
else {
|
|
632
|
+
const G = C * se(C);
|
|
633
|
+
R.y = Math.abs(G) < Math.abs(C) ? G : C;
|
|
634
|
+
}
|
|
635
|
+
} else if (a.value === "x" && (M.includes("left") || M.includes("right")))
|
|
636
|
+
if (M.includes("left") && I < 0 || M.includes("right") && I > 0) R.x = I;
|
|
637
|
+
else {
|
|
638
|
+
const G = I * se(I);
|
|
639
|
+
R.x = Math.abs(G) < Math.abs(I) ? G : I;
|
|
640
|
+
}
|
|
641
|
+
(Math.abs(R.x) > 0 || Math.abs(R.y) > 0) && (m.value = !0), (ie = w.value) == null || ie.style.setProperty("--swipe-amount-x", `${R.x}px`), (ae = w.value) == null || ae.style.setProperty("--swipe-amount-y", `${R.y}px`);
|
|
642
|
+
}
|
|
643
|
+
Pe(() => {
|
|
644
|
+
if (p.value = !0, !w.value) return;
|
|
645
|
+
const o = w.value.offsetHeight;
|
|
646
|
+
B.value = o;
|
|
647
|
+
const A = [{
|
|
648
|
+
toastId: t.toast.id,
|
|
649
|
+
height: o,
|
|
650
|
+
position: t.toast.position || t.position
|
|
651
|
+
}, ...t.heights];
|
|
652
|
+
i("update:heights", A);
|
|
653
|
+
}), Oe(() => {
|
|
654
|
+
w.value && i("removeToast", t.toast);
|
|
655
|
+
}), J((o) => {
|
|
656
|
+
if (t.toast.promise && u.value === "loading" || t.toast.duration === 1 / 0 || t.toast.type === "loading") return;
|
|
657
|
+
let A;
|
|
658
|
+
const C = () => {
|
|
659
|
+
if (f.value < y.value) {
|
|
660
|
+
const M = (/* @__PURE__ */ new Date()).getTime() - y.value;
|
|
661
|
+
c.value = c.value - M;
|
|
662
|
+
}
|
|
663
|
+
f.value = (/* @__PURE__ */ new Date()).getTime();
|
|
664
|
+
}, I = () => {
|
|
665
|
+
c.value !== 1 / 0 && (y.value = (/* @__PURE__ */ new Date()).getTime(), A = setTimeout(() => {
|
|
666
|
+
var M, R;
|
|
667
|
+
(R = (M = t.toast).onAutoClose) == null || R.call(M, t.toast), Z();
|
|
668
|
+
}, c.value));
|
|
669
|
+
};
|
|
670
|
+
t.expanded || t.interacting || ge.value ? C() : I(), o(() => {
|
|
671
|
+
clearTimeout(A);
|
|
672
|
+
});
|
|
673
|
+
}), pt(() => t.toast.delete, (o) => {
|
|
674
|
+
var A, C;
|
|
675
|
+
o !== void 0 && o && (Z(), (C = (A = t.toast).onDismiss) == null || C.call(A, t.toast));
|
|
676
|
+
}, { deep: !0 });
|
|
677
|
+
function ut() {
|
|
678
|
+
l.value = !1, a.value = null, P.value = null;
|
|
679
|
+
}
|
|
680
|
+
return (o, A) => {
|
|
681
|
+
var C, I, M, R, se, oe, ne, ie, ae, G, Me, Re, Ne, ze, Fe, Ue, We, Ve, je, qe, Ye, Ge, Ke, Qe, Xe, Ze, Je;
|
|
682
|
+
return d(), g("li", {
|
|
683
|
+
tabindex: "0",
|
|
684
|
+
ref_key: "toastRef",
|
|
685
|
+
ref: w,
|
|
686
|
+
class: K(N(le)(t.class, D.value, (C = o.classes) == null ? void 0 : C.toast, (I = o.toast.classes) == null ? void 0 : I.toast, (M = o.classes) == null ? void 0 : M[u.value], (se = (R = o.toast) == null ? void 0 : R.classes) == null ? void 0 : se[u.value])),
|
|
687
|
+
"data-sonner-toast": "",
|
|
688
|
+
"data-rich-colors": o.toast.richColors ?? o.defaultRichColors,
|
|
689
|
+
"data-styled": !(o.toast.component || (oe = o.toast) != null && oe.unstyled || o.unstyled),
|
|
690
|
+
"data-mounted": p.value,
|
|
691
|
+
"data-promise": !!o.toast.promise,
|
|
692
|
+
"data-swiped": m.value,
|
|
693
|
+
"data-removed": k.value,
|
|
694
|
+
"data-visible": H.value,
|
|
695
|
+
"data-y-position": ue.value,
|
|
696
|
+
"data-x-position": X.value,
|
|
697
|
+
"data-index": o.index,
|
|
698
|
+
"data-front": x.value,
|
|
699
|
+
"data-swiping": l.value,
|
|
700
|
+
"data-dismissible": $.value,
|
|
701
|
+
"data-type": u.value,
|
|
702
|
+
"data-invert": o.toast.invert || o.invert,
|
|
703
|
+
"data-swipe-out": r.value,
|
|
704
|
+
"data-swipe-direction": h.value,
|
|
705
|
+
"data-expanded": !!(o.expanded || o.expandByDefault && p.value),
|
|
706
|
+
"data-testid": o.toast.testId,
|
|
707
|
+
style: V({
|
|
708
|
+
"--index": o.index,
|
|
709
|
+
"--toasts-before": o.index,
|
|
710
|
+
"--z-index": o.toasts.length - o.index,
|
|
711
|
+
"--offset": `${k.value ? _.value : v.value}px`,
|
|
712
|
+
"--initial-height": o.expandByDefault ? "auto" : `${B.value}px`,
|
|
713
|
+
...o.style,
|
|
714
|
+
...t.toast.style
|
|
715
|
+
}),
|
|
716
|
+
onDragend: ut,
|
|
717
|
+
onPointerdown: De,
|
|
718
|
+
onPointerup: lt,
|
|
719
|
+
onPointermove: rt
|
|
720
|
+
}, [S.value && !o.toast.component && u.value !== "loading" ? (d(), g("button", {
|
|
721
|
+
key: 0,
|
|
722
|
+
"aria-label": o.closeButtonAriaLabel || "Close toast",
|
|
723
|
+
"data-disabled": me.value,
|
|
724
|
+
"data-close-button": "true",
|
|
725
|
+
"data-close-button-position": o.closeButtonPosition,
|
|
726
|
+
class: K(N(le)((ne = o.classes) == null ? void 0 : ne.closeButton, (ae = (ie = o.toast) == null ? void 0 : ie.classes) == null ? void 0 : ae.closeButton)),
|
|
727
|
+
onClick: be
|
|
728
|
+
}, [(G = o.icons) != null && G.close ? (d(), re(fe((Me = o.icons) == null ? void 0 : Me.close), { key: 0 })) : q(o.$slots, "close-icon", { key: 1 })], 10, Vt)) : Q("v-if", !0), o.toast.component ? (d(), re(fe(o.toast.component), Ae({ key: 1 }, o.toast.componentProps, {
|
|
729
|
+
onCloseToast: be,
|
|
730
|
+
isPaused: o.$props.expanded || o.$props.interacting || N(ge)
|
|
731
|
+
}), null, 16, ["isPaused"])) : (d(), g(j, { key: 2 }, [
|
|
732
|
+
u.value !== "default" || o.toast.icon || o.toast.promise ? (d(), g("div", {
|
|
733
|
+
key: 0,
|
|
734
|
+
"data-icon": "",
|
|
735
|
+
class: K(N(le)((Re = o.classes) == null ? void 0 : Re.icon, (ze = (Ne = o.toast) == null ? void 0 : Ne.classes) == null ? void 0 : ze.icon))
|
|
736
|
+
}, [o.toast.icon ? (d(), re(fe(o.toast.icon), { key: 0 })) : (d(), g(j, { key: 1 }, [u.value === "loading" ? q(o.$slots, "loading-icon", { key: 0 }) : u.value === "success" ? q(o.$slots, "success-icon", { key: 1 }) : u.value === "error" ? q(o.$slots, "error-icon", { key: 2 }) : u.value === "warning" ? q(o.$slots, "warning-icon", { key: 3 }) : u.value === "info" ? q(o.$slots, "info-icon", { key: 4 }) : Q("v-if", !0)], 64))], 2)) : Q("v-if", !0),
|
|
737
|
+
O("div", {
|
|
738
|
+
"data-content": "",
|
|
739
|
+
class: K(N(le)((Fe = o.classes) == null ? void 0 : Fe.content, (We = (Ue = o.toast) == null ? void 0 : Ue.classes) == null ? void 0 : We.content))
|
|
740
|
+
}, [O("div", {
|
|
741
|
+
"data-title": "",
|
|
742
|
+
class: K(N(le)((Ve = o.classes) == null ? void 0 : Ve.title, (je = o.toast.classes) == null ? void 0 : je.title))
|
|
743
|
+
}, [Ee.value ? (d(), re(fe(o.toast.title), et(Ae({ key: 0 }, o.toast.componentProps)), null, 16)) : (d(), g(j, { key: 1 }, [tt(Be(o.toast.title), 1)], 64))], 2), o.toast.description ? (d(), g("div", {
|
|
744
|
+
key: 0,
|
|
745
|
+
"data-description": "",
|
|
746
|
+
class: K(N(le)(o.descriptionClass, U.value, (qe = o.classes) == null ? void 0 : qe.description, (Ye = o.toast.classes) == null ? void 0 : Ye.description))
|
|
747
|
+
}, [Se.value ? (d(), re(fe(o.toast.description), et(Ae({ key: 0 }, o.toast.componentProps)), null, 16)) : (d(), g(j, { key: 1 }, [tt(Be(o.toast.description), 1)], 64))], 2)) : Q("v-if", !0)], 2),
|
|
748
|
+
o.toast.cancel ? (d(), g("button", {
|
|
749
|
+
key: 1,
|
|
750
|
+
style: V(o.toast.cancelButtonStyle || o.cancelButtonStyle),
|
|
751
|
+
class: K(N(le)((Ge = o.classes) == null ? void 0 : Ge.cancelButton, (Ke = o.toast.classes) == null ? void 0 : Ke.cancelButton)),
|
|
752
|
+
"data-button": "",
|
|
753
|
+
"data-cancel": "",
|
|
754
|
+
onClick: A[0] || (A[0] = ($e) => {
|
|
755
|
+
var we, ke;
|
|
756
|
+
N(Ie)(o.toast.cancel) && $.value && ((ke = (we = o.toast.cancel).onClick) == null || ke.call(we, $e), Z());
|
|
757
|
+
})
|
|
758
|
+
}, Be(N(Ie)(o.toast.cancel) ? (Qe = o.toast.cancel) == null ? void 0 : Qe.label : o.toast.cancel), 7)) : Q("v-if", !0),
|
|
759
|
+
o.toast.action ? (d(), g("button", {
|
|
760
|
+
key: 2,
|
|
761
|
+
style: V(o.toast.actionButtonStyle || o.actionButtonStyle),
|
|
762
|
+
class: K(N(le)((Xe = o.classes) == null ? void 0 : Xe.actionButton, (Ze = o.toast.classes) == null ? void 0 : Ze.actionButton)),
|
|
763
|
+
"data-button": "",
|
|
764
|
+
"data-action": "",
|
|
765
|
+
onClick: A[1] || (A[1] = ($e) => {
|
|
766
|
+
var we, ke;
|
|
767
|
+
N(Ie)(o.toast.action) && ((ke = (we = o.toast.action).onClick) == null || ke.call(we, $e), !$e.defaultPrevented && Z());
|
|
768
|
+
})
|
|
769
|
+
}, Be(N(Ie)(o.toast.action) ? (Je = o.toast.action) == null ? void 0 : Je.label : o.toast.action), 7)) : Q("v-if", !0)
|
|
770
|
+
], 64))], 46, Wt);
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
}), qt = jt, Ce = (s, e) => {
|
|
774
|
+
const t = s.__vccOpts || s;
|
|
775
|
+
for (const [i, a] of e) t[i] = a;
|
|
776
|
+
return t;
|
|
777
|
+
};
|
|
778
|
+
const Yt = {}, Gt = {
|
|
779
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
780
|
+
width: "12",
|
|
781
|
+
height: "12",
|
|
782
|
+
viewBox: "0 0 24 24",
|
|
783
|
+
fill: "none",
|
|
784
|
+
stroke: "currentColor",
|
|
785
|
+
"stoke-width": "1.5",
|
|
786
|
+
"stroke-linecap": "round",
|
|
787
|
+
"stroke-linejoin": "round"
|
|
788
|
+
};
|
|
789
|
+
function Kt(s, e) {
|
|
790
|
+
return d(), g("svg", Gt, e[0] || (e[0] = [O("line", {
|
|
791
|
+
x1: "18",
|
|
792
|
+
y1: "6",
|
|
793
|
+
x2: "6",
|
|
794
|
+
y2: "18"
|
|
795
|
+
}, null, -1), O("line", {
|
|
796
|
+
x1: "6",
|
|
797
|
+
y1: "6",
|
|
798
|
+
x2: "18",
|
|
799
|
+
y2: "18"
|
|
800
|
+
}, null, -1)]));
|
|
801
|
+
}
|
|
802
|
+
var Qt = /* @__PURE__ */ Ce(Yt, [["render", Kt]]);
|
|
803
|
+
const Xt = ["data-visible"], Zt = { class: "sonner-spinner" };
|
|
804
|
+
var Jt = /* @__PURE__ */ ye({
|
|
805
|
+
__name: "Loader",
|
|
806
|
+
props: { visible: { type: Boolean } },
|
|
807
|
+
setup(s) {
|
|
808
|
+
const e = Array(12).fill(0);
|
|
809
|
+
return (t, i) => (d(), g("div", {
|
|
810
|
+
class: "sonner-loading-wrapper",
|
|
811
|
+
"data-visible": t.visible
|
|
812
|
+
}, [O("div", Zt, [(d(!0), g(j, null, ee(N(e), (a) => (d(), g("div", {
|
|
813
|
+
key: `spinner-bar-${a}`,
|
|
814
|
+
class: "sonner-loading-bar"
|
|
815
|
+
}))), 128))])], 8, Xt));
|
|
816
|
+
}
|
|
817
|
+
}), es = Jt;
|
|
818
|
+
const ts = {}, ss = {
|
|
819
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
820
|
+
viewBox: "0 0 20 20",
|
|
821
|
+
fill: "currentColor",
|
|
822
|
+
height: "20",
|
|
823
|
+
width: "20"
|
|
824
|
+
};
|
|
825
|
+
function os(s, e) {
|
|
826
|
+
return d(), g("svg", ss, e[0] || (e[0] = [O("path", {
|
|
827
|
+
"fill-rule": "evenodd",
|
|
828
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
829
|
+
"clip-rule": "evenodd"
|
|
830
|
+
}, null, -1)]));
|
|
831
|
+
}
|
|
832
|
+
var ns = /* @__PURE__ */ Ce(ts, [["render", os]]);
|
|
833
|
+
const is = {}, as = {
|
|
834
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
835
|
+
viewBox: "0 0 20 20",
|
|
836
|
+
fill: "currentColor",
|
|
837
|
+
height: "20",
|
|
838
|
+
width: "20"
|
|
839
|
+
};
|
|
840
|
+
function ls(s, e) {
|
|
841
|
+
return d(), g("svg", as, e[0] || (e[0] = [O("path", {
|
|
842
|
+
"fill-rule": "evenodd",
|
|
843
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
844
|
+
"clip-rule": "evenodd"
|
|
845
|
+
}, null, -1)]));
|
|
846
|
+
}
|
|
847
|
+
var rs = /* @__PURE__ */ Ce(is, [["render", ls]]);
|
|
848
|
+
const us = {}, cs = {
|
|
849
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
850
|
+
viewBox: "0 0 24 24",
|
|
851
|
+
fill: "currentColor",
|
|
852
|
+
height: "20",
|
|
853
|
+
width: "20"
|
|
854
|
+
};
|
|
855
|
+
function ds(s, e) {
|
|
856
|
+
return d(), g("svg", cs, e[0] || (e[0] = [O("path", {
|
|
857
|
+
"fill-rule": "evenodd",
|
|
858
|
+
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
859
|
+
"clip-rule": "evenodd"
|
|
860
|
+
}, null, -1)]));
|
|
861
|
+
}
|
|
862
|
+
var fs = /* @__PURE__ */ Ce(us, [["render", ds]]);
|
|
863
|
+
const ps = {}, ms = {
|
|
864
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
865
|
+
viewBox: "0 0 20 20",
|
|
866
|
+
fill: "currentColor",
|
|
867
|
+
height: "20",
|
|
868
|
+
width: "20"
|
|
869
|
+
};
|
|
870
|
+
function vs(s, e) {
|
|
871
|
+
return d(), g("svg", ms, e[0] || (e[0] = [O("path", {
|
|
872
|
+
"fill-rule": "evenodd",
|
|
873
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
874
|
+
"clip-rule": "evenodd"
|
|
875
|
+
}, null, -1)]));
|
|
876
|
+
}
|
|
877
|
+
var hs = /* @__PURE__ */ Ce(ps, [["render", vs]]);
|
|
878
|
+
const ys = ["aria-label"], gs = [
|
|
879
|
+
"data-sonner-theme",
|
|
880
|
+
"dir",
|
|
881
|
+
"data-theme",
|
|
882
|
+
"data-rich-colors",
|
|
883
|
+
"data-y-position",
|
|
884
|
+
"data-x-position"
|
|
885
|
+
], bs = typeof window < "u" && typeof document < "u";
|
|
886
|
+
function ws() {
|
|
887
|
+
if (typeof window > "u" || typeof document > "u") return "ltr";
|
|
888
|
+
const s = document.documentElement.getAttribute("dir");
|
|
889
|
+
return s === "auto" || !s ? window.getComputedStyle(document.documentElement).direction : s;
|
|
890
|
+
}
|
|
891
|
+
var ks = /* @__PURE__ */ ye({
|
|
892
|
+
name: "Toaster",
|
|
893
|
+
inheritAttrs: !1,
|
|
894
|
+
__name: "Toaster",
|
|
895
|
+
props: {
|
|
896
|
+
id: {},
|
|
897
|
+
invert: {
|
|
898
|
+
type: Boolean,
|
|
899
|
+
default: !1
|
|
900
|
+
},
|
|
901
|
+
theme: { default: "light" },
|
|
902
|
+
position: { default: "bottom-right" },
|
|
903
|
+
closeButtonPosition: { default: "top-left" },
|
|
904
|
+
hotkey: { default: () => ["altKey", "KeyT"] },
|
|
905
|
+
richColors: {
|
|
906
|
+
type: Boolean,
|
|
907
|
+
default: !1
|
|
908
|
+
},
|
|
909
|
+
expand: {
|
|
910
|
+
type: Boolean,
|
|
911
|
+
default: !1
|
|
912
|
+
},
|
|
913
|
+
duration: {},
|
|
914
|
+
gap: { default: Rt },
|
|
915
|
+
visibleToasts: { default: Ht },
|
|
916
|
+
closeButton: {
|
|
917
|
+
type: Boolean,
|
|
918
|
+
default: !1
|
|
919
|
+
},
|
|
920
|
+
toastOptions: { default: () => ({}) },
|
|
921
|
+
class: { default: "" },
|
|
922
|
+
style: {},
|
|
923
|
+
offset: { default: nt },
|
|
924
|
+
mobileOffset: { default: it },
|
|
925
|
+
dir: { default: "auto" },
|
|
926
|
+
swipeDirections: {},
|
|
927
|
+
icons: {},
|
|
928
|
+
containerAriaLabel: { default: "Notifications" }
|
|
929
|
+
},
|
|
930
|
+
setup(s) {
|
|
931
|
+
const e = s, t = ft(), i = E([]), a = L(() => e.id ? i.value.filter((n) => n.toasterId === e.id) : i.value.filter((n) => !n.toasterId));
|
|
932
|
+
function h(n, y) {
|
|
933
|
+
return a.value.filter((f) => !f.position && y === 0 || f.position === n);
|
|
934
|
+
}
|
|
935
|
+
const p = L(() => {
|
|
936
|
+
const n = a.value.filter((y) => y.position).map((y) => y.position);
|
|
937
|
+
return n.length > 0 ? Array.from(new Set([e.position].concat(n))) : [e.position];
|
|
938
|
+
}), k = L(() => {
|
|
939
|
+
const n = {};
|
|
940
|
+
return p.value.forEach((y) => {
|
|
941
|
+
n[y] = i.value.filter((f) => f.position === y);
|
|
942
|
+
}), n;
|
|
943
|
+
}), l = E([]), r = E({}), m = E(!1);
|
|
944
|
+
J(() => {
|
|
945
|
+
p.value.forEach((n) => {
|
|
946
|
+
n in r.value || (r.value[n] = !1);
|
|
947
|
+
});
|
|
948
|
+
});
|
|
949
|
+
const _ = E(e.theme !== "system" ? e.theme : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), B = E(null), c = E(null), b = E(!1), w = e.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
950
|
+
function x(n) {
|
|
951
|
+
var y;
|
|
952
|
+
(y = i.value.find((f) => f.id === n.id)) != null && y.delete || Y.dismiss(n.id), i.value = i.value.filter(({ id: f }) => f !== n.id), setTimeout(() => {
|
|
953
|
+
i.value.find((f) => f.id === n.id) || (l.value = l.value.filter((f) => f.toastId !== n.id));
|
|
954
|
+
}, at + 50);
|
|
955
|
+
}
|
|
956
|
+
function H(n) {
|
|
957
|
+
var y, f;
|
|
958
|
+
b.value && !((f = (y = n.currentTarget) == null ? void 0 : y.contains) != null && f.call(y, n.relatedTarget)) && (b.value = !1, c.value && (c.value.focus({ preventScroll: !0 }), c.value = null));
|
|
959
|
+
}
|
|
960
|
+
function u(n) {
|
|
961
|
+
n.target instanceof HTMLElement && n.target.dataset.dismissible === "false" || b.value || (b.value = !0, c.value = n.relatedTarget);
|
|
962
|
+
}
|
|
963
|
+
function $(n) {
|
|
964
|
+
n.target && n.target instanceof HTMLElement && n.target.dataset.dismissible === "false" || (m.value = !0);
|
|
965
|
+
}
|
|
966
|
+
J((n) => {
|
|
967
|
+
const y = Y.subscribe((f) => {
|
|
968
|
+
if (f.dismiss) {
|
|
969
|
+
requestAnimationFrame(() => {
|
|
970
|
+
i.value = i.value.map((P) => P.id === f.id ? {
|
|
971
|
+
...P,
|
|
972
|
+
delete: !0
|
|
973
|
+
} : P);
|
|
974
|
+
});
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
Le(() => {
|
|
978
|
+
const P = i.value.findIndex((z) => z.id === f.id);
|
|
979
|
+
P !== -1 ? i.value = [
|
|
980
|
+
...i.value.slice(0, P),
|
|
981
|
+
{
|
|
982
|
+
...i.value[P],
|
|
983
|
+
...f
|
|
984
|
+
},
|
|
985
|
+
...i.value.slice(P + 1)
|
|
986
|
+
] : i.value = [f, ...i.value];
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
n(y);
|
|
990
|
+
}), J((n) => {
|
|
991
|
+
if (typeof window > "u") return;
|
|
992
|
+
if (e.theme !== "system") {
|
|
993
|
+
_.value = e.theme;
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
const y = window.matchMedia("(prefers-color-scheme: dark)"), f = (z) => {
|
|
997
|
+
_.value = z ? "dark" : "light";
|
|
998
|
+
};
|
|
999
|
+
f(y.matches);
|
|
1000
|
+
const P = (z) => {
|
|
1001
|
+
f(z.matches);
|
|
1002
|
+
};
|
|
1003
|
+
try {
|
|
1004
|
+
y.addEventListener("change", P);
|
|
1005
|
+
} catch {
|
|
1006
|
+
y.addListener(P);
|
|
1007
|
+
}
|
|
1008
|
+
n(() => {
|
|
1009
|
+
try {
|
|
1010
|
+
y.removeEventListener("change", P);
|
|
1011
|
+
} catch {
|
|
1012
|
+
y.removeListener(P);
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
}), J(() => {
|
|
1016
|
+
B.value && c.value && (c.value.focus({ preventScroll: !0 }), c.value = null, b.value = !1);
|
|
1017
|
+
}), J(() => {
|
|
1018
|
+
i.value.length <= 1 && Object.keys(r.value).forEach((n) => {
|
|
1019
|
+
r.value[n] = !1;
|
|
1020
|
+
});
|
|
1021
|
+
}), J((n) => {
|
|
1022
|
+
function y(f) {
|
|
1023
|
+
const P = e.hotkey.every((X) => f[X] || f.code === X), z = Array.isArray(B.value) ? B.value[0] : B.value;
|
|
1024
|
+
P && (p.value.forEach((X) => {
|
|
1025
|
+
r.value[X] = !0;
|
|
1026
|
+
}), z == null || z.focus());
|
|
1027
|
+
const ue = document.activeElement === B.value || (z == null ? void 0 : z.contains(document.activeElement));
|
|
1028
|
+
f.code === "Escape" && ue && p.value.forEach((X) => {
|
|
1029
|
+
r.value[X] = !1;
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
bs && (document.addEventListener("keydown", y), n(() => {
|
|
1033
|
+
document.removeEventListener("keydown", y);
|
|
1034
|
+
}));
|
|
1035
|
+
});
|
|
1036
|
+
function D(n) {
|
|
1037
|
+
const y = n.currentTarget, f = y.getAttribute("data-y-position") + "-" + y.getAttribute("data-x-position");
|
|
1038
|
+
r.value[f] = !0;
|
|
1039
|
+
}
|
|
1040
|
+
function U(n) {
|
|
1041
|
+
if (!m.value) {
|
|
1042
|
+
const y = n.currentTarget, f = y.getAttribute("data-y-position") + "-" + y.getAttribute("data-x-position");
|
|
1043
|
+
r.value[f] = !1;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
function pe() {
|
|
1047
|
+
Object.keys(r.value).forEach((n) => {
|
|
1048
|
+
r.value[n] = !1;
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
function T() {
|
|
1052
|
+
m.value = !1;
|
|
1053
|
+
}
|
|
1054
|
+
function v(n) {
|
|
1055
|
+
l.value = n;
|
|
1056
|
+
}
|
|
1057
|
+
function S(n) {
|
|
1058
|
+
const y = l.value.findIndex((f) => f.toastId === n.toastId);
|
|
1059
|
+
if (y !== -1) l.value[y] = n;
|
|
1060
|
+
else {
|
|
1061
|
+
const f = l.value.findIndex((P) => P.position === n.position);
|
|
1062
|
+
f !== -1 ? l.value.splice(f, 0, n) : l.value.unshift(n);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
return (n, y) => (d(), g(j, null, [Q(" Remove item from normal navigation flow, only available via hotkey "), O("section", {
|
|
1066
|
+
"aria-label": `${n.containerAriaLabel} ${N(w)}`,
|
|
1067
|
+
tabIndex: -1,
|
|
1068
|
+
"aria-live": "polite",
|
|
1069
|
+
"aria-relevant": "additions text",
|
|
1070
|
+
"aria-atomic": "false"
|
|
1071
|
+
}, [(d(!0), g(j, null, ee(p.value, (f, P) => {
|
|
1072
|
+
var z;
|
|
1073
|
+
return d(), g("ol", Ae({
|
|
1074
|
+
key: f,
|
|
1075
|
+
ref_for: !0,
|
|
1076
|
+
ref_key: "listRef",
|
|
1077
|
+
ref: B,
|
|
1078
|
+
"data-sonner-toaster": "",
|
|
1079
|
+
"data-sonner-theme": _.value,
|
|
1080
|
+
class: e.class,
|
|
1081
|
+
dir: n.dir === "auto" ? ws() : n.dir,
|
|
1082
|
+
tabIndex: -1,
|
|
1083
|
+
"data-theme": n.theme,
|
|
1084
|
+
"data-rich-colors": n.richColors,
|
|
1085
|
+
"data-y-position": f.split("-")[0],
|
|
1086
|
+
"data-x-position": f.split("-")[1],
|
|
1087
|
+
style: {
|
|
1088
|
+
"--front-toast-height": `${((z = l.value[0]) == null ? void 0 : z.height) || 0}px`,
|
|
1089
|
+
"--width": `${N(Lt)}px`,
|
|
1090
|
+
"--gap": `${n.gap}px`,
|
|
1091
|
+
...n.style,
|
|
1092
|
+
...N(t).style,
|
|
1093
|
+
...N(Ut)(n.offset, n.mobileOffset)
|
|
1094
|
+
}
|
|
1095
|
+
}, { ref_for: !0 }, n.$attrs, {
|
|
1096
|
+
onBlur: H,
|
|
1097
|
+
onFocus: u,
|
|
1098
|
+
onMouseenter: D,
|
|
1099
|
+
onMousemove: D,
|
|
1100
|
+
onMouseleave: U,
|
|
1101
|
+
onDragend: pe,
|
|
1102
|
+
onPointerdown: $,
|
|
1103
|
+
onPointerup: T
|
|
1104
|
+
}), [(d(!0), g(j, null, ee(h(f, P), (ue, X) => {
|
|
1105
|
+
var Ee, Se, ge, me, W, te, ve, he, Z, be, De;
|
|
1106
|
+
return d(), re(qt, {
|
|
1107
|
+
key: ue.id,
|
|
1108
|
+
heights: l.value,
|
|
1109
|
+
icons: n.icons,
|
|
1110
|
+
index: X,
|
|
1111
|
+
toast: ue,
|
|
1112
|
+
defaultRichColors: n.richColors,
|
|
1113
|
+
duration: ((Ee = n.toastOptions) == null ? void 0 : Ee.duration) ?? n.duration,
|
|
1114
|
+
class: K(((Se = n.toastOptions) == null ? void 0 : Se.class) ?? ""),
|
|
1115
|
+
descriptionClass: (ge = n.toastOptions) == null ? void 0 : ge.descriptionClass,
|
|
1116
|
+
invert: n.invert,
|
|
1117
|
+
visibleToasts: n.visibleToasts,
|
|
1118
|
+
closeButton: ((me = n.toastOptions) == null ? void 0 : me.closeButton) ?? n.closeButton,
|
|
1119
|
+
interacting: m.value,
|
|
1120
|
+
position: f,
|
|
1121
|
+
closeButtonPosition: ((W = n.toastOptions) == null ? void 0 : W.closeButtonPosition) ?? n.closeButtonPosition,
|
|
1122
|
+
style: V((te = n.toastOptions) == null ? void 0 : te.style),
|
|
1123
|
+
unstyled: (ve = n.toastOptions) == null ? void 0 : ve.unstyled,
|
|
1124
|
+
classes: (he = n.toastOptions) == null ? void 0 : he.classes,
|
|
1125
|
+
cancelButtonStyle: (Z = n.toastOptions) == null ? void 0 : Z.cancelButtonStyle,
|
|
1126
|
+
actionButtonStyle: (be = n.toastOptions) == null ? void 0 : be.actionButtonStyle,
|
|
1127
|
+
"close-button-aria-label": (De = n.toastOptions) == null ? void 0 : De.closeButtonAriaLabel,
|
|
1128
|
+
toasts: k.value[f],
|
|
1129
|
+
expandByDefault: n.expand,
|
|
1130
|
+
gap: n.gap,
|
|
1131
|
+
expanded: r.value[f] || !1,
|
|
1132
|
+
swipeDirections: e.swipeDirections,
|
|
1133
|
+
"onUpdate:heights": v,
|
|
1134
|
+
"onUpdate:height": S,
|
|
1135
|
+
onRemoveToast: x
|
|
1136
|
+
}, {
|
|
1137
|
+
"close-icon": de(() => [q(n.$slots, "close-icon", {}, () => [ce(Qt)])]),
|
|
1138
|
+
"loading-icon": de(() => [q(n.$slots, "loading-icon", {}, () => [ce(es, { visible: ue.type === "loading" }, null, 8, ["visible"])])]),
|
|
1139
|
+
"success-icon": de(() => [q(n.$slots, "success-icon", {}, () => [ce(ns)])]),
|
|
1140
|
+
"error-icon": de(() => [q(n.$slots, "error-icon", {}, () => [ce(hs)])]),
|
|
1141
|
+
"warning-icon": de(() => [q(n.$slots, "warning-icon", {}, () => [ce(fs)])]),
|
|
1142
|
+
"info-icon": de(() => [q(n.$slots, "info-icon", {}, () => [ce(rs)])]),
|
|
1143
|
+
_: 2
|
|
1144
|
+
}, 1032, [
|
|
1145
|
+
"heights",
|
|
1146
|
+
"icons",
|
|
1147
|
+
"index",
|
|
1148
|
+
"toast",
|
|
1149
|
+
"defaultRichColors",
|
|
1150
|
+
"duration",
|
|
1151
|
+
"class",
|
|
1152
|
+
"descriptionClass",
|
|
1153
|
+
"invert",
|
|
1154
|
+
"visibleToasts",
|
|
1155
|
+
"closeButton",
|
|
1156
|
+
"interacting",
|
|
1157
|
+
"position",
|
|
1158
|
+
"closeButtonPosition",
|
|
1159
|
+
"style",
|
|
1160
|
+
"unstyled",
|
|
1161
|
+
"classes",
|
|
1162
|
+
"cancelButtonStyle",
|
|
1163
|
+
"actionButtonStyle",
|
|
1164
|
+
"close-button-aria-label",
|
|
1165
|
+
"toasts",
|
|
1166
|
+
"expandByDefault",
|
|
1167
|
+
"gap",
|
|
1168
|
+
"expanded",
|
|
1169
|
+
"swipeDirections"
|
|
1170
|
+
]);
|
|
1171
|
+
}), 128))], 16, gs);
|
|
1172
|
+
}), 128))], 8, ys)], 2112));
|
|
1173
|
+
}
|
|
1174
|
+
}), Os = ks;
|
|
1175
|
+
const Ts = 5e3;
|
|
1176
|
+
function _e(s, e, t = {}) {
|
|
1177
|
+
const i = t.duration && t.duration > 0 ? t.duration : Ts;
|
|
1178
|
+
return He[s](e, {
|
|
1179
|
+
description: t.detail,
|
|
1180
|
+
action: t.action ? { label: t.action.label, onClick: () => {
|
|
1181
|
+
var a;
|
|
1182
|
+
return (a = t.action) == null ? void 0 : a.onClick();
|
|
1183
|
+
} } : void 0,
|
|
1184
|
+
duration: i
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
function Bs() {
|
|
1188
|
+
return {
|
|
1189
|
+
success: (s, e) => _e("success", s, e),
|
|
1190
|
+
info: (s, e) => _e("info", s, e),
|
|
1191
|
+
warning: (s, e) => _e("warning", s, e),
|
|
1192
|
+
error: (s, e) => _e("error", s, e),
|
|
1193
|
+
dismiss: (s) => He.dismiss(s),
|
|
1194
|
+
clear: () => He.dismiss()
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
function Ms() {
|
|
1198
|
+
const s = Bs();
|
|
1199
|
+
async function e(t) {
|
|
1200
|
+
try {
|
|
1201
|
+
if (navigator.clipboard && window.isSecureContext)
|
|
1202
|
+
await navigator.clipboard.writeText(t);
|
|
1203
|
+
else {
|
|
1204
|
+
const i = document.activeElement, a = document.getSelection(), h = a ? Array.from({ length: a.rangeCount }, (k, l) => a.getRangeAt(l).cloneRange()) : [], p = document.createElement("textarea");
|
|
1205
|
+
p.value = t, p.readOnly = !0, p.style.position = "fixed", p.style.opacity = "0", document.body.appendChild(p);
|
|
1206
|
+
try {
|
|
1207
|
+
if (p.select(), !document.execCommand("copy")) throw new Error("Clipboard write failed");
|
|
1208
|
+
} finally {
|
|
1209
|
+
p.remove(), i == null || i.focus({ preventScroll: !0 }), a == null || a.removeAllRanges();
|
|
1210
|
+
for (const k of h) a == null || a.addRange(k);
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
return s.success("Copied to clipboard"), !0;
|
|
1214
|
+
} catch {
|
|
1215
|
+
return s.error("Couldn’t copy to clipboard", { detail: "Select the text and copy it manually." }), !1;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return { copy: e };
|
|
1219
|
+
}
|
|
1220
|
+
const xs = /* @__PURE__ */ ye({
|
|
1221
|
+
__name: "ItProse",
|
|
1222
|
+
props: {
|
|
1223
|
+
as: { default: "div" }
|
|
1224
|
+
},
|
|
1225
|
+
setup(s) {
|
|
1226
|
+
return (e, t) => (d(), re(fe(s.as), { class: "it-prose" }, {
|
|
1227
|
+
default: de(() => [
|
|
1228
|
+
q(e.$slots, "default")
|
|
1229
|
+
]),
|
|
1230
|
+
_: 3
|
|
1231
|
+
}));
|
|
1232
|
+
}
|
|
1233
|
+
}), Cs = /^[A-Za-z]{1,12}-[A-Za-z0-9_-]{2,}$|^\d{5,}$|^\S*\d{4,}\S*$/, Es = /* @__PURE__ */ new Set(["how", "what", "why", "when", "where", "which", "who", "whose", "can", "could", "should", "would", "will", "is", "are", "am", "do", "does", "did"]), Ss = /* @__PURE__ */ new Set([
|
|
1234
|
+
"explain",
|
|
1235
|
+
"summarize",
|
|
1236
|
+
"summarise",
|
|
1237
|
+
"draft",
|
|
1238
|
+
"create",
|
|
1239
|
+
"build",
|
|
1240
|
+
"make",
|
|
1241
|
+
"help",
|
|
1242
|
+
"show",
|
|
1243
|
+
"compare",
|
|
1244
|
+
"audit",
|
|
1245
|
+
"write",
|
|
1246
|
+
"generate",
|
|
1247
|
+
"recommend",
|
|
1248
|
+
"suggest",
|
|
1249
|
+
"analyze",
|
|
1250
|
+
"analyse",
|
|
1251
|
+
"review",
|
|
1252
|
+
"tell",
|
|
1253
|
+
"walk",
|
|
1254
|
+
"check",
|
|
1255
|
+
"list",
|
|
1256
|
+
"plan",
|
|
1257
|
+
"start",
|
|
1258
|
+
"set",
|
|
1259
|
+
"configure",
|
|
1260
|
+
"add",
|
|
1261
|
+
"give"
|
|
1262
|
+
]);
|
|
1263
|
+
function Hs(s) {
|
|
1264
|
+
const e = s.trim();
|
|
1265
|
+
if (!e) return "search";
|
|
1266
|
+
if (e.endsWith("?")) return "ask";
|
|
1267
|
+
const t = e.split(/\s+/);
|
|
1268
|
+
if (t.length === 1 && Cs.test(e) || t.length <= 2) return "search";
|
|
1269
|
+
if (t.length >= 7) return "ask";
|
|
1270
|
+
const i = t[0].toLowerCase();
|
|
1271
|
+
return Es.has(i) || Ss.has(i) && t.length >= 3 ? "ask" : "ambiguous";
|
|
1272
|
+
}
|
|
1273
|
+
function Ls(s, ...e) {
|
|
1274
|
+
const t = s.trim().toLowerCase();
|
|
1275
|
+
return t ? e.some((i) => i == null ? void 0 : i.toLowerCase().includes(t)) : !0;
|
|
1276
|
+
}
|
|
1277
|
+
const Rs = Symbol("it-thread-shown");
|
|
1278
|
+
function ot() {
|
|
1279
|
+
return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `conversation-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1280
|
+
}
|
|
1281
|
+
function Ns(s) {
|
|
1282
|
+
const e = () => (typeof s == "function" ? s() : s) ?? null, t = E([]), i = E(!1), a = E({}), h = E(ot());
|
|
1283
|
+
let p = null, k = 0;
|
|
1284
|
+
async function l(c) {
|
|
1285
|
+
!e() || i.value || (t.value = [...t.value, { id: `m${k++}`, role: "user", text: c, tools: [], attachments: [], done: !0 }], await r());
|
|
1286
|
+
}
|
|
1287
|
+
async function r() {
|
|
1288
|
+
const c = e();
|
|
1289
|
+
if (!c || i.value) return;
|
|
1290
|
+
const b = t.value.filter((T) => T.done && !T.error && (T.role === "user" || T.text)).map((T) => ({ role: T.role, content: T.text })), w = () => ({ id: `m${k++}`, role: "assistant", text: "", tools: [], attachments: [], done: !1 });
|
|
1291
|
+
let x = w();
|
|
1292
|
+
t.value = [...t.value, x];
|
|
1293
|
+
const H = (T) => {
|
|
1294
|
+
const v = x.id;
|
|
1295
|
+
t.value = t.value.map((S) => S.id === v ? T(S) : S);
|
|
1296
|
+
}, u = (T, v) => T.map((S) => S.state === "running" ? { ...S, state: v ? "error" : "done", detail: S.detail ?? (v ? "Stopped" : void 0) } : S), $ = new AbortController();
|
|
1297
|
+
let D = !1;
|
|
1298
|
+
const U = (T) => {
|
|
1299
|
+
if (D) return;
|
|
1300
|
+
D = !0, H((S) => ({ ...S, done: !0, stopped: T || void 0, tools: u(S.tools, T) }));
|
|
1301
|
+
const v = t.value.find((S) => S.id === x.id);
|
|
1302
|
+
T && v && !v.text && !v.tools.length && (t.value = t.value.filter((S) => S.id !== x.id)), (p == null ? void 0 : p.controller) === $ && (p = null, i.value = !1);
|
|
1303
|
+
};
|
|
1304
|
+
p = { controller: $, finish: U }, i.value = !0;
|
|
1305
|
+
const pe = (T) => {
|
|
1306
|
+
if (!D)
|
|
1307
|
+
switch (T.type) {
|
|
1308
|
+
case "message": {
|
|
1309
|
+
const v = t.value.find((S) => S.id === x.id);
|
|
1310
|
+
if (!v || !v.text && !v.tools.length && !v.attachments.length && !v.action && !v.error) break;
|
|
1311
|
+
H((S) => ({ ...S, done: !0, tools: u(S.tools, !1) })), x = w(), t.value = [...t.value, x];
|
|
1312
|
+
break;
|
|
1313
|
+
}
|
|
1314
|
+
case "text":
|
|
1315
|
+
H((v) => ({ ...v, text: v.text + T.delta }));
|
|
1316
|
+
break;
|
|
1317
|
+
case "text-set":
|
|
1318
|
+
H((v) => ({ ...v, text: T.text }));
|
|
1319
|
+
break;
|
|
1320
|
+
case "tool-start":
|
|
1321
|
+
H((v) => ({ ...v, tools: [...v.tools, { id: T.id, label: T.label, state: "running" }] }));
|
|
1322
|
+
break;
|
|
1323
|
+
case "tool-done":
|
|
1324
|
+
H((v) => ({ ...v, tools: v.tools.map((S) => S.id === T.id ? { ...S, state: "done", detail: T.summary } : S) }));
|
|
1325
|
+
break;
|
|
1326
|
+
case "tool-error":
|
|
1327
|
+
H((v) => ({ ...v, tools: v.tools.map((S) => S.id === T.id ? { ...S, state: "error", detail: T.error } : S) }));
|
|
1328
|
+
break;
|
|
1329
|
+
case "attachment":
|
|
1330
|
+
H((v) => ({ ...v, attachments: [...v.attachments, T.attachment] }));
|
|
1331
|
+
break;
|
|
1332
|
+
case "action":
|
|
1333
|
+
H((v) => ({ ...v, action: T.action }));
|
|
1334
|
+
break;
|
|
1335
|
+
case "error":
|
|
1336
|
+
H((v) => ({ ...v, error: T.message, errorDetails: T.details }));
|
|
1337
|
+
break;
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
try {
|
|
1341
|
+
await c.send({ messages: b, conversationId: h.value, signal: $.signal }, pe);
|
|
1342
|
+
} catch (T) {
|
|
1343
|
+
!D && !$.signal.aborted && H((v) => ({ ...v, error: T instanceof Error && T.message ? `The assistant stopped: ${T.message}` : "The assistant stopped before it answered." }));
|
|
1344
|
+
} finally {
|
|
1345
|
+
U($.signal.aborted);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
function m() {
|
|
1349
|
+
const c = p;
|
|
1350
|
+
c && (c.controller.abort(), c.finish(!0));
|
|
1351
|
+
}
|
|
1352
|
+
function _() {
|
|
1353
|
+
if (i.value) return;
|
|
1354
|
+
const c = t.value[t.value.length - 1];
|
|
1355
|
+
if ((c == null ? void 0 : c.role) === "assistant" && c.error) {
|
|
1356
|
+
const b = t.value.map((w) => w.role).lastIndexOf("user") + 1;
|
|
1357
|
+
for (const w of t.value.slice(b)) delete a.value[w.id];
|
|
1358
|
+
t.value = t.value.slice(0, b);
|
|
1359
|
+
}
|
|
1360
|
+
r();
|
|
1361
|
+
}
|
|
1362
|
+
function B() {
|
|
1363
|
+
m(), t.value = [], a.value = {}, h.value = ot();
|
|
1364
|
+
}
|
|
1365
|
+
return { messages: t, busy: i, shown: a, conversationId: h, send: l, stop: m, retry: _, newThread: B };
|
|
1366
|
+
}
|
|
1367
|
+
export {
|
|
1368
|
+
Rs as I,
|
|
1369
|
+
Os as T,
|
|
1370
|
+
xs as _,
|
|
1371
|
+
_s as a,
|
|
1372
|
+
Ps as b,
|
|
1373
|
+
Ns as c,
|
|
1374
|
+
Ts as d,
|
|
1375
|
+
Ls as e,
|
|
1376
|
+
Bs as f,
|
|
1377
|
+
Hs as i,
|
|
1378
|
+
ot as n,
|
|
1379
|
+
As as s,
|
|
1380
|
+
Ms as u
|
|
1381
|
+
};
|