@opentiny/tiny-robot 0.5.2-alpha.15 → 0.5.2-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anchor/index.js +32 -32
- package/dist/container/index.js +16 -15
- package/dist/dropdown-menu/index.js +141 -97
- package/dist/extension-manager/index.js +814 -292
- package/dist/index.d.ts +402 -228
- package/dist/index.js +64 -61
- package/dist/index3.js +92 -95
- package/dist/index6.js +641 -622
- package/dist/index7.js +296 -186
- package/dist/model-selector/index.js +517 -522
- package/dist/sender/index.js +111 -111
- package/dist/style.css +1 -1
- package/dist/useStableId.js +15 -0
- package/package.json +3 -3
|
@@ -1,128 +1,129 @@
|
|
|
1
|
-
import { shallowRef as V, computed as g, watch as
|
|
2
|
-
import { IconCheck as
|
|
3
|
-
import { a as
|
|
4
|
-
import { u as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { shallowRef as V, computed as g, watch as J, nextTick as Z, defineComponent as X, openBlock as p, createElementBlock as b, createElementVNode as z, toDisplayString as q, Fragment as oe, renderList as ne, normalizeClass as Q, withModifiers as me, renderSlot as D, createBlock as _, resolveDynamicComponent as re, createCommentVNode as B, createVNode as W, unref as P, createSlots as ee, withCtx as U, mergeProps as ie, onMounted as se, onBeforeUnmount as ge, normalizeStyle as pe, normalizeProps as j, guardReactiveProps as N, onScopeDispose as ye, toRaw as be, getCurrentInstance as we, Teleport as ke } from "vue";
|
|
2
|
+
import { IconCheck as $e, IconSearch as Ee, IconNoData as Se, IconArrowDown as Oe } from "@opentiny/tiny-robot-svgs";
|
|
3
|
+
import { a as xe, c as Me, o as Pe, f as Ve, s as Te, b as Ce } from "../floating-ui.dom.js";
|
|
4
|
+
import { u as Ie } from "../useStableId.js";
|
|
5
|
+
import { u as De } from "../useTeleportTarget.js";
|
|
6
|
+
function ze(e) {
|
|
7
|
+
const a = V(""), o = g(() => a.value.trim()), t = g(() => {
|
|
8
|
+
const h = e.options(), r = o.value;
|
|
9
|
+
if (!e.searchable() || !r)
|
|
10
|
+
return h;
|
|
11
|
+
const i = e.filterMethod();
|
|
12
|
+
if (i)
|
|
13
|
+
return h.filter((d) => i(r, d.raw));
|
|
14
|
+
const s = r.toLocaleLowerCase();
|
|
15
|
+
return h.filter((d) => d.searchText.includes(s));
|
|
16
|
+
}), c = g(() => {
|
|
17
|
+
const h = /* @__PURE__ */ new Map();
|
|
18
|
+
return t.value.forEach((r) => {
|
|
19
|
+
var s, d;
|
|
20
|
+
const i = h.get(r.groupKey);
|
|
21
|
+
if (i) {
|
|
22
|
+
i.items.push(r);
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
key:
|
|
26
|
-
index:
|
|
27
|
-
group: ((
|
|
28
|
-
label: ((
|
|
29
|
-
items: [
|
|
25
|
+
h.set(r.groupKey, {
|
|
26
|
+
key: r.groupKey,
|
|
27
|
+
index: h.size,
|
|
28
|
+
group: ((s = r.raw.group) == null ? void 0 : s.trim()) ?? "",
|
|
29
|
+
label: ((d = r.raw.group) == null ? void 0 : d.trim()) ?? "",
|
|
30
|
+
items: [r]
|
|
30
31
|
});
|
|
31
|
-
}), [...
|
|
32
|
-
}), f = g(() =>
|
|
33
|
-
function
|
|
34
|
-
a.value =
|
|
32
|
+
}), [...h.values()];
|
|
33
|
+
}), f = g(() => t.value.length === 0);
|
|
34
|
+
function u(h) {
|
|
35
|
+
a.value = h;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function v() {
|
|
37
38
|
a.value = "";
|
|
38
39
|
}
|
|
39
40
|
return {
|
|
40
41
|
query: a,
|
|
41
|
-
visibleOptions:
|
|
42
|
-
groups:
|
|
42
|
+
visibleOptions: t,
|
|
43
|
+
groups: c,
|
|
43
44
|
isEmpty: f,
|
|
44
|
-
setQuery:
|
|
45
|
-
clearQuery:
|
|
45
|
+
setQuery: u,
|
|
46
|
+
clearQuery: v
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
const a = V(null),
|
|
50
|
-
function
|
|
51
|
-
return e.options().filter((
|
|
49
|
+
function Be(e) {
|
|
50
|
+
const a = V(null), o = g(() => e.options().find((r) => r.key === a.value) ?? null);
|
|
51
|
+
function t() {
|
|
52
|
+
return e.options().filter((r) => !r.disabled);
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
-
if (
|
|
54
|
+
function c(r) {
|
|
55
|
+
if (r === null) {
|
|
55
56
|
a.value = null;
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
|
-
const
|
|
59
|
-
|
|
59
|
+
const i = e.options().find((s) => s.key === r);
|
|
60
|
+
i && !i.disabled && (a.value = i.key);
|
|
60
61
|
}
|
|
61
62
|
function f() {
|
|
62
63
|
a.value = null;
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
a.value = (
|
|
65
|
+
function u(r) {
|
|
66
|
+
const i = t(), s = r === "first" ? i[0] : i[i.length - 1];
|
|
67
|
+
a.value = (s == null ? void 0 : s.key) ?? null;
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
a.value =
|
|
69
|
+
function v(r = "first") {
|
|
70
|
+
const i = e.selectedValue(), s = e.options().find((d) => d.value === i && !d.disabled);
|
|
71
|
+
if (s) {
|
|
72
|
+
a.value = s.key;
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
u(r);
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
-
var
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
77
|
+
function h(r) {
|
|
78
|
+
var S, k;
|
|
79
|
+
const i = t();
|
|
80
|
+
if (i.length === 0) {
|
|
80
81
|
f();
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
a.value = ((
|
|
84
|
+
const s = i.findIndex((y) => y.key === a.value);
|
|
85
|
+
if (s < 0) {
|
|
86
|
+
const y = r === 1 ? 0 : i.length - 1;
|
|
87
|
+
a.value = ((S = i[y]) == null ? void 0 : S.key) ?? null;
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
|
-
const
|
|
90
|
-
a.value = ((
|
|
90
|
+
const d = (s + r + i.length) % i.length;
|
|
91
|
+
a.value = ((k = i[d]) == null ? void 0 : k.key) ?? null;
|
|
91
92
|
}
|
|
92
|
-
return
|
|
93
|
+
return J(
|
|
93
94
|
() => [e.enabled(), e.options(), e.selectedValue()],
|
|
94
|
-
([
|
|
95
|
-
if (!
|
|
95
|
+
([r, i, s], d) => {
|
|
96
|
+
if (!r) {
|
|
96
97
|
f();
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
a.value =
|
|
100
|
+
const S = d == null ? void 0 : d[2], k = i.find(($) => $.value === s && !$.disabled);
|
|
101
|
+
if (s !== S && k) {
|
|
102
|
+
a.value = k.key;
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
|
-
(a.value ?
|
|
105
|
+
(a.value ? i.some(($) => $.key === a.value && !$.disabled) : !1) || v("first");
|
|
105
106
|
},
|
|
106
107
|
{ immediate: !0 }
|
|
107
|
-
),
|
|
108
|
-
if (!
|
|
108
|
+
), J(a, async (r) => {
|
|
109
|
+
if (!r || !e.enabled())
|
|
109
110
|
return;
|
|
110
111
|
await Z();
|
|
111
|
-
const
|
|
112
|
-
(
|
|
113
|
-
).find((
|
|
114
|
-
|
|
112
|
+
const i = e.containerEl.value, s = Array.from(
|
|
113
|
+
(i == null ? void 0 : i.querySelectorAll("[data-model-selector-option-key]")) ?? []
|
|
114
|
+
).find((d) => d.dataset.modelSelectorOptionKey === r);
|
|
115
|
+
s == null || s.scrollIntoView({ block: "nearest" });
|
|
115
116
|
}), {
|
|
116
117
|
highlightedKey: a,
|
|
117
|
-
highlightedOption:
|
|
118
|
-
setHighlightedKey:
|
|
118
|
+
highlightedOption: o,
|
|
119
|
+
setHighlightedKey: c,
|
|
119
120
|
resetHighlight: f,
|
|
120
|
-
highlightBoundary:
|
|
121
|
-
highlightSelectedOrBoundary:
|
|
122
|
-
moveHighlight:
|
|
121
|
+
highlightBoundary: u,
|
|
122
|
+
highlightSelectedOrBoundary: v,
|
|
123
|
+
moveHighlight: h
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
|
-
const
|
|
126
|
+
const Le = { class: "tr-model-selector__effort" }, Re = { class: "tr-model-selector__effort-label" }, Ke = ["aria-label"], qe = ["disabled", "aria-pressed", "data-model-selector-effort-value", "onClick"], Fe = /* @__PURE__ */ X({
|
|
126
127
|
name: "TrModelSelectorEffort",
|
|
127
128
|
__name: "ModelSelectorEffort",
|
|
128
129
|
props: {
|
|
@@ -133,26 +134,26 @@ const Re = { class: "tr-model-selector__effort" }, Ke = { class: "tr-model-selec
|
|
|
133
134
|
},
|
|
134
135
|
emits: ["select"],
|
|
135
136
|
setup(e) {
|
|
136
|
-
return (a,
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
return (a, o) => (p(), b("div", Le, [
|
|
138
|
+
z("span", Re, q(e.label), 1),
|
|
139
|
+
z("div", {
|
|
139
140
|
class: "tr-model-selector__effort-options",
|
|
140
141
|
role: "group",
|
|
141
142
|
"aria-label": e.label
|
|
142
143
|
}, [
|
|
143
|
-
(p(!0), b(
|
|
144
|
-
key:
|
|
144
|
+
(p(!0), b(oe, null, ne(e.options, (t) => (p(), b("button", {
|
|
145
|
+
key: t.value,
|
|
145
146
|
type: "button",
|
|
146
|
-
class:
|
|
147
|
-
disabled: e.disabled ||
|
|
148
|
-
"aria-pressed":
|
|
149
|
-
"data-model-selector-effort-value":
|
|
150
|
-
onClick: (
|
|
151
|
-
},
|
|
152
|
-
], 8,
|
|
147
|
+
class: Q(["tr-model-selector__effort-option", { "is-active": t.value === e.value }]),
|
|
148
|
+
disabled: e.disabled || t.disabled,
|
|
149
|
+
"aria-pressed": t.value === e.value,
|
|
150
|
+
"data-model-selector-effort-value": t.value,
|
|
151
|
+
onClick: (c) => a.$emit("select", t.value)
|
|
152
|
+
}, q(t.label), 11, qe))), 128))
|
|
153
|
+
], 8, Ke)
|
|
153
154
|
]));
|
|
154
155
|
}
|
|
155
|
-
}),
|
|
156
|
+
}), Ae = ["id", "data-model-selector-option-key", "aria-selected", "aria-disabled", "aria-describedby"], He = { class: "tr-model-selector__option-main" }, Ue = ["src"], je = { class: "tr-model-selector__option-text" }, Ne = ["title"], We = ["id", "title"], Qe = /* @__PURE__ */ X({
|
|
156
157
|
name: "TrModelSelectorItem",
|
|
157
158
|
__name: "ModelSelectorItem",
|
|
158
159
|
props: {
|
|
@@ -164,16 +165,16 @@ const Re = { class: "tr-model-selector__effort" }, Ke = { class: "tr-model-selec
|
|
|
164
165
|
},
|
|
165
166
|
emits: ["hover", "select"],
|
|
166
167
|
setup(e, { emit: a }) {
|
|
167
|
-
const
|
|
168
|
-
function
|
|
169
|
-
|
|
168
|
+
const o = e, t = a;
|
|
169
|
+
function c() {
|
|
170
|
+
o.option.disabled || t("hover", o.option.key);
|
|
170
171
|
}
|
|
171
172
|
function f() {
|
|
172
|
-
|
|
173
|
+
o.option.disabled || t("select", o.option.raw);
|
|
173
174
|
}
|
|
174
|
-
return (
|
|
175
|
+
return (u, v) => (p(), b("div", {
|
|
175
176
|
id: e.optionId,
|
|
176
|
-
class:
|
|
177
|
+
class: Q(["tr-model-selector__option", {
|
|
177
178
|
"is-selected": e.selected,
|
|
178
179
|
"is-highlighted": e.highlighted,
|
|
179
180
|
"is-disabled": e.option.disabled
|
|
@@ -182,52 +183,52 @@ const Re = { class: "tr-model-selector__effort" }, Ke = { class: "tr-model-selec
|
|
|
182
183
|
role: "option",
|
|
183
184
|
"aria-selected": e.selected,
|
|
184
185
|
"aria-disabled": e.option.disabled || void 0,
|
|
185
|
-
"aria-describedby": e.option.description && !
|
|
186
|
-
onMouseenter:
|
|
187
|
-
onMousedown:
|
|
186
|
+
"aria-describedby": e.option.description && !u.$slots.item ? e.descriptionId : void 0,
|
|
187
|
+
onMouseenter: c,
|
|
188
|
+
onMousedown: v[0] || (v[0] = me(() => {
|
|
188
189
|
}, ["prevent"])),
|
|
189
190
|
onClick: f
|
|
190
191
|
}, [
|
|
191
|
-
D(
|
|
192
|
+
D(u.$slots, "item", {
|
|
192
193
|
option: e.option.raw,
|
|
193
194
|
selected: e.selected,
|
|
194
195
|
highlighted: e.highlighted
|
|
195
196
|
}, () => [
|
|
196
|
-
|
|
197
|
+
z("span", He, [
|
|
197
198
|
typeof e.option.icon == "string" ? (p(), b("img", {
|
|
198
199
|
key: 0,
|
|
199
200
|
src: e.option.icon,
|
|
200
201
|
class: "tr-model-selector__option-icon",
|
|
201
202
|
alt: "",
|
|
202
203
|
"aria-hidden": "true"
|
|
203
|
-
}, null, 8,
|
|
204
|
+
}, null, 8, Ue)) : e.option.icon ? (p(), _(re(e.option.icon), {
|
|
204
205
|
key: 1,
|
|
205
206
|
class: "tr-model-selector__option-icon",
|
|
206
207
|
"aria-hidden": "true",
|
|
207
208
|
focusable: "false"
|
|
208
|
-
})) :
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
})) : B("", !0),
|
|
210
|
+
z("span", je, [
|
|
211
|
+
z("span", {
|
|
211
212
|
class: "tr-model-selector__option-label",
|
|
212
213
|
title: e.option.label
|
|
213
|
-
},
|
|
214
|
+
}, q(e.option.label), 9, Ne),
|
|
214
215
|
e.option.description ? (p(), b("span", {
|
|
215
216
|
key: 0,
|
|
216
217
|
id: e.descriptionId,
|
|
217
218
|
class: "tr-model-selector__option-description",
|
|
218
219
|
title: e.option.description
|
|
219
|
-
},
|
|
220
|
+
}, q(e.option.description), 9, We)) : B("", !0)
|
|
220
221
|
])
|
|
221
222
|
]),
|
|
222
|
-
|
|
223
|
+
W(P($e), {
|
|
223
224
|
class: "tr-model-selector__option-check",
|
|
224
225
|
"aria-hidden": "true",
|
|
225
226
|
focusable: "false"
|
|
226
227
|
})
|
|
227
228
|
])
|
|
228
|
-
], 42,
|
|
229
|
+
], 42, Ae));
|
|
229
230
|
}
|
|
230
|
-
}),
|
|
231
|
+
}), Ge = ["role", "aria-labelledby"], Ye = ["id"], Je = /* @__PURE__ */ X({
|
|
231
232
|
name: "TrModelSelectorGroup",
|
|
232
233
|
__name: "ModelSelectorGroup",
|
|
233
234
|
props: {
|
|
@@ -238,7 +239,7 @@ const Re = { class: "tr-model-selector__effort" }, Ke = { class: "tr-model-selec
|
|
|
238
239
|
},
|
|
239
240
|
emits: ["hover", "select"],
|
|
240
241
|
setup(e) {
|
|
241
|
-
return (a,
|
|
242
|
+
return (a, o) => (p(), b("div", {
|
|
242
243
|
class: "tr-model-selector__group",
|
|
243
244
|
role: e.group.label ? "group" : "presentation",
|
|
244
245
|
"aria-labelledby": e.group.label ? `${e.optionIdPrefix}-group-${e.group.index}` : void 0
|
|
@@ -247,42 +248,42 @@ const Re = { class: "tr-model-selector__effort" }, Ke = { class: "tr-model-selec
|
|
|
247
248
|
key: 0,
|
|
248
249
|
id: `${e.optionIdPrefix}-group-${e.group.index}`,
|
|
249
250
|
class: "tr-model-selector__group-title"
|
|
250
|
-
},
|
|
251
|
-
(p(!0), b(
|
|
252
|
-
key:
|
|
253
|
-
option:
|
|
254
|
-
selected: e.selectedValue ===
|
|
255
|
-
highlighted: e.highlightedKey ===
|
|
256
|
-
"option-id": `${e.optionIdPrefix}-option-${
|
|
257
|
-
"description-id": `${e.optionIdPrefix}-option-${
|
|
258
|
-
onHover:
|
|
259
|
-
onSelect:
|
|
260
|
-
},
|
|
251
|
+
}, q(e.group.label), 9, Ye)) : B("", !0),
|
|
252
|
+
(p(!0), b(oe, null, ne(e.group.items, (t) => (p(), _(Qe, {
|
|
253
|
+
key: t.key,
|
|
254
|
+
option: t,
|
|
255
|
+
selected: e.selectedValue === t.value,
|
|
256
|
+
highlighted: e.highlightedKey === t.key,
|
|
257
|
+
"option-id": `${e.optionIdPrefix}-option-${t.index}`,
|
|
258
|
+
"description-id": `${e.optionIdPrefix}-option-${t.index}-description`,
|
|
259
|
+
onHover: o[0] || (o[0] = (c) => a.$emit("hover", c)),
|
|
260
|
+
onSelect: o[1] || (o[1] = (c) => a.$emit("select", c))
|
|
261
|
+
}, ee({ _: 2 }, [
|
|
261
262
|
a.$slots.item ? {
|
|
262
263
|
name: "item",
|
|
263
|
-
fn:
|
|
264
|
-
D(a.$slots, "item",
|
|
264
|
+
fn: U((c) => [
|
|
265
|
+
D(a.$slots, "item", ie({ ref_for: !0 }, c))
|
|
265
266
|
]),
|
|
266
267
|
key: "0"
|
|
267
268
|
} : void 0
|
|
268
269
|
]), 1032, ["option", "selected", "highlighted", "option-id", "description-id"]))), 128))
|
|
269
|
-
], 8,
|
|
270
|
+
], 8, Ge));
|
|
270
271
|
}
|
|
271
|
-
}),
|
|
272
|
+
}), Xe = {
|
|
272
273
|
key: 0,
|
|
273
274
|
class: "tr-model-selector__header"
|
|
274
|
-
},
|
|
275
|
+
}, Ze = {
|
|
275
276
|
key: 1,
|
|
276
277
|
class: "tr-model-selector__search"
|
|
277
|
-
},
|
|
278
|
+
}, _e = ["value", "placeholder", "aria-label", "aria-controls", "aria-activedescendant"], et = {
|
|
278
279
|
key: 2,
|
|
279
280
|
class: "tr-model-selector__empty",
|
|
280
281
|
role: "status",
|
|
281
282
|
"aria-live": "polite"
|
|
282
|
-
},
|
|
283
|
+
}, tt = ["id", "aria-label", "aria-activedescendant"], lt = {
|
|
283
284
|
key: 3,
|
|
284
285
|
class: "tr-model-selector__footer"
|
|
285
|
-
},
|
|
286
|
+
}, ot = /* @__PURE__ */ X({
|
|
286
287
|
name: "TrModelSelectorPanel",
|
|
287
288
|
__name: "ModelSelectorPanel",
|
|
288
289
|
props: {
|
|
@@ -305,198 +306,198 @@ const Re = { class: "tr-model-selector__effort" }, Ke = { class: "tr-model-selec
|
|
|
305
306
|
},
|
|
306
307
|
emits: ["select", "select-effort", "close"],
|
|
307
308
|
setup(e, { emit: a }) {
|
|
308
|
-
const
|
|
309
|
-
let
|
|
310
|
-
const
|
|
311
|
-
() =>
|
|
312
|
-
),
|
|
313
|
-
options: () =>
|
|
314
|
-
searchable: () =>
|
|
315
|
-
filterMethod: () =>
|
|
316
|
-
}),
|
|
309
|
+
const o = e, t = a, c = V(null), f = V(null), u = V(null), v = V(null);
|
|
310
|
+
let h;
|
|
311
|
+
const r = g(
|
|
312
|
+
() => v.value === null ? void 0 : { "--tr-model-selector-open-min-width": `${v.value}px` }
|
|
313
|
+
), i = ze({
|
|
314
|
+
options: () => o.options,
|
|
315
|
+
searchable: () => o.searchable,
|
|
316
|
+
filterMethod: () => o.filterMethod
|
|
317
|
+
}), s = Be({
|
|
317
318
|
enabled: () => !0,
|
|
318
|
-
options: () =>
|
|
319
|
-
selectedValue: () =>
|
|
319
|
+
options: () => i.visibleOptions.value,
|
|
320
|
+
selectedValue: () => o.selectedValue,
|
|
320
321
|
containerEl: f
|
|
321
|
-
}),
|
|
322
|
-
const
|
|
323
|
-
return
|
|
324
|
-
}),
|
|
325
|
-
...
|
|
326
|
-
query:
|
|
327
|
-
})),
|
|
328
|
-
...
|
|
329
|
-
reasoningEfforts:
|
|
330
|
-
reasoningEffortOption:
|
|
331
|
-
setReasoningEffort: (
|
|
322
|
+
}), d = g(() => {
|
|
323
|
+
const l = s.highlightedOption.value;
|
|
324
|
+
return l ? `${o.optionIdPrefix}-option-${l.index}` : void 0;
|
|
325
|
+
}), S = g(() => ({
|
|
326
|
+
...o.slotContext,
|
|
327
|
+
query: i.query.value
|
|
328
|
+
})), k = g(() => ({
|
|
329
|
+
...S.value,
|
|
330
|
+
reasoningEfforts: o.effortOptions,
|
|
331
|
+
reasoningEffortOption: o.effortOptions.find((l) => l.value === o.effortValue) ?? null,
|
|
332
|
+
setReasoningEffort: (l) => t("select-effort", l)
|
|
332
333
|
}));
|
|
333
|
-
function
|
|
334
|
-
|
|
334
|
+
function y(l) {
|
|
335
|
+
i.setQuery(l.target.value);
|
|
335
336
|
}
|
|
336
337
|
function $() {
|
|
337
|
-
const
|
|
338
|
-
|
|
338
|
+
const l = o.searchable ? c.value : f.value;
|
|
339
|
+
l == null || l.focus({ preventScroll: !0 });
|
|
339
340
|
}
|
|
340
|
-
async function
|
|
341
|
-
var
|
|
341
|
+
async function O() {
|
|
342
|
+
var x, M;
|
|
342
343
|
await Z();
|
|
343
|
-
const
|
|
344
|
-
if (!
|
|
344
|
+
const l = ((x = c.value) == null ? void 0 : x.ownerDocument.defaultView) ?? ((M = f.value) == null ? void 0 : M.ownerDocument.defaultView);
|
|
345
|
+
if (!l || typeof l.requestAnimationFrame != "function") {
|
|
345
346
|
$();
|
|
346
347
|
return;
|
|
347
348
|
}
|
|
348
|
-
|
|
349
|
+
l.requestAnimationFrame(() => {
|
|
349
350
|
$();
|
|
350
351
|
});
|
|
351
352
|
}
|
|
352
|
-
function
|
|
353
|
-
const
|
|
354
|
-
|
|
353
|
+
function K() {
|
|
354
|
+
const l = s.highlightedOption.value;
|
|
355
|
+
l && t("select", l.raw);
|
|
355
356
|
}
|
|
356
|
-
function
|
|
357
|
-
return
|
|
357
|
+
function w(l) {
|
|
358
|
+
return l.isComposing || l.keyCode === 229;
|
|
358
359
|
}
|
|
359
|
-
function
|
|
360
|
-
if (!(
|
|
361
|
-
if (
|
|
362
|
-
|
|
360
|
+
function G(l) {
|
|
361
|
+
if (!(l.defaultPrevented || w(l))) {
|
|
362
|
+
if (l.key === "ArrowDown" || l.key === "ArrowUp") {
|
|
363
|
+
l.preventDefault(), s.moveHighlight(l.key === "ArrowDown" ? 1 : -1);
|
|
363
364
|
return;
|
|
364
365
|
}
|
|
365
|
-
if (
|
|
366
|
-
|
|
366
|
+
if (l.key === "Enter") {
|
|
367
|
+
l.preventDefault(), K();
|
|
367
368
|
return;
|
|
368
369
|
}
|
|
369
|
-
|
|
370
|
+
l.key === "Escape" && (l.preventDefault(), t("close", !0));
|
|
370
371
|
}
|
|
371
372
|
}
|
|
372
|
-
function
|
|
373
|
-
if (!(
|
|
374
|
-
if (
|
|
375
|
-
|
|
373
|
+
function T(l) {
|
|
374
|
+
if (!(l.defaultPrevented || w(l))) {
|
|
375
|
+
if (l.key === "ArrowDown" || l.key === "ArrowUp") {
|
|
376
|
+
l.preventDefault(), s.moveHighlight(l.key === "ArrowDown" ? 1 : -1);
|
|
376
377
|
return;
|
|
377
378
|
}
|
|
378
|
-
if (
|
|
379
|
-
|
|
379
|
+
if (l.key === "Home" || l.key === "End") {
|
|
380
|
+
l.preventDefault(), s.highlightBoundary(l.key === "Home" ? "first" : "last");
|
|
380
381
|
return;
|
|
381
382
|
}
|
|
382
|
-
(
|
|
383
|
+
(l.key === "Enter" || l.key === " " || l.key === "Spacebar") && (l.preventDefault(), K());
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
|
-
function
|
|
386
|
-
|
|
386
|
+
function R(l) {
|
|
387
|
+
l.defaultPrevented || l.key === "Escape" && (l.preventDefault(), t("close", !0));
|
|
387
388
|
}
|
|
388
|
-
return
|
|
389
|
-
var
|
|
390
|
-
const
|
|
389
|
+
return se(() => {
|
|
390
|
+
var I;
|
|
391
|
+
const l = u.value, x = (I = l == null ? void 0 : l.ownerDocument.defaultView) == null ? void 0 : I.ResizeObserver;
|
|
391
392
|
function M() {
|
|
392
|
-
if (!
|
|
393
|
+
if (!l)
|
|
393
394
|
return;
|
|
394
|
-
const
|
|
395
|
-
|
|
395
|
+
const Y = Math.ceil(l.getBoundingClientRect().width);
|
|
396
|
+
Y > (v.value ?? 0) && (v.value = Y);
|
|
396
397
|
}
|
|
397
|
-
M(),
|
|
398
|
-
}),
|
|
399
|
-
|
|
400
|
-
}),
|
|
401
|
-
() =>
|
|
398
|
+
M(), l && x && (h = new x(M), h.observe(l)), O();
|
|
399
|
+
}), ge(() => {
|
|
400
|
+
h == null || h.disconnect();
|
|
401
|
+
}), J(
|
|
402
|
+
() => o.searchable,
|
|
402
403
|
async () => {
|
|
403
|
-
|
|
404
|
+
i.clearQuery(), await O();
|
|
404
405
|
}
|
|
405
|
-
), (
|
|
406
|
+
), (l, x) => (p(), b("div", {
|
|
406
407
|
ref_key: "panelEl",
|
|
407
|
-
ref:
|
|
408
|
-
class:
|
|
409
|
-
style:
|
|
410
|
-
onKeydown:
|
|
408
|
+
ref: u,
|
|
409
|
+
class: Q(["tr-model-selector__panel", [`tr-model-selector__panel--${e.size}`, e.panelClass]]),
|
|
410
|
+
style: pe(r.value),
|
|
411
|
+
onKeydown: R
|
|
411
412
|
}, [
|
|
412
|
-
|
|
413
|
-
D(
|
|
414
|
-
])) :
|
|
415
|
-
e.searchable ? (p(), b("div",
|
|
416
|
-
|
|
413
|
+
l.$slots.header ? (p(), b("div", Xe, [
|
|
414
|
+
D(l.$slots, "header", j(N(S.value)))
|
|
415
|
+
])) : B("", !0),
|
|
416
|
+
e.searchable ? (p(), b("div", Ze, [
|
|
417
|
+
W(P(Ee), {
|
|
417
418
|
class: "tr-model-selector__search-icon",
|
|
418
419
|
"aria-hidden": "true",
|
|
419
420
|
focusable: "false"
|
|
420
421
|
}),
|
|
421
|
-
|
|
422
|
+
z("input", {
|
|
422
423
|
ref_key: "searchInputEl",
|
|
423
|
-
ref:
|
|
424
|
+
ref: c,
|
|
424
425
|
type: "text",
|
|
425
426
|
class: "tr-model-selector__search-input",
|
|
426
427
|
"data-model-selector-search-input": "",
|
|
427
428
|
role: "combobox",
|
|
428
|
-
value: P(
|
|
429
|
+
value: P(i).query.value,
|
|
429
430
|
placeholder: e.searchPlaceholder,
|
|
430
431
|
"aria-label": e.searchPlaceholder,
|
|
431
432
|
"aria-controls": e.listboxId,
|
|
432
|
-
"aria-activedescendant":
|
|
433
|
+
"aria-activedescendant": d.value,
|
|
433
434
|
"aria-autocomplete": "list",
|
|
434
435
|
"aria-expanded": "true",
|
|
435
436
|
"aria-haspopup": "listbox",
|
|
436
437
|
autocomplete: "off",
|
|
437
438
|
spellcheck: !1,
|
|
438
|
-
onInput:
|
|
439
|
-
onKeydown:
|
|
440
|
-
}, null, 40,
|
|
441
|
-
])) :
|
|
442
|
-
P(
|
|
443
|
-
D(
|
|
444
|
-
query: P(
|
|
439
|
+
onInput: y,
|
|
440
|
+
onKeydown: G
|
|
441
|
+
}, null, 40, _e)
|
|
442
|
+
])) : B("", !0),
|
|
443
|
+
P(i).isEmpty.value ? (p(), b("div", et, [
|
|
444
|
+
D(l.$slots, "empty", {
|
|
445
|
+
query: P(i).query.value
|
|
445
446
|
}, () => [
|
|
446
|
-
|
|
447
|
+
W(P(Se), {
|
|
447
448
|
class: "tr-model-selector__empty-icon",
|
|
448
449
|
"aria-hidden": "true",
|
|
449
450
|
focusable: "false"
|
|
450
451
|
}),
|
|
451
|
-
|
|
452
|
+
z("span", null, q(e.emptyText), 1)
|
|
452
453
|
])
|
|
453
|
-
])) :
|
|
454
|
-
|
|
454
|
+
])) : B("", !0),
|
|
455
|
+
z("div", {
|
|
455
456
|
id: e.listboxId,
|
|
456
457
|
ref_key: "listboxEl",
|
|
457
458
|
ref: f,
|
|
458
|
-
class:
|
|
459
|
+
class: Q(["tr-model-selector__content", { "is-empty": P(i).isEmpty.value }]),
|
|
459
460
|
role: "listbox",
|
|
460
461
|
tabindex: "-1",
|
|
461
462
|
"aria-label": e.placeholder,
|
|
462
|
-
"aria-activedescendant": e.searchable ? void 0 :
|
|
463
|
-
onKeydown:
|
|
463
|
+
"aria-activedescendant": e.searchable ? void 0 : d.value,
|
|
464
|
+
onKeydown: T
|
|
464
465
|
}, [
|
|
465
|
-
(p(!0), b(
|
|
466
|
+
(p(!0), b(oe, null, ne(P(i).groups.value, (M) => (p(), _(Je, {
|
|
466
467
|
key: M.key,
|
|
467
468
|
group: M,
|
|
468
469
|
"selected-value": e.selectedValue,
|
|
469
|
-
"highlighted-key": P(
|
|
470
|
+
"highlighted-key": P(s).highlightedKey.value,
|
|
470
471
|
"option-id-prefix": e.optionIdPrefix,
|
|
471
|
-
onHover: P(
|
|
472
|
-
onSelect:
|
|
473
|
-
},
|
|
474
|
-
|
|
472
|
+
onHover: P(s).setHighlightedKey,
|
|
473
|
+
onSelect: x[0] || (x[0] = (I) => l.$emit("select", I))
|
|
474
|
+
}, ee({ _: 2 }, [
|
|
475
|
+
l.$slots.item ? {
|
|
475
476
|
name: "item",
|
|
476
|
-
fn:
|
|
477
|
-
D(
|
|
477
|
+
fn: U((I) => [
|
|
478
|
+
D(l.$slots, "item", ie({ ref_for: !0 }, I))
|
|
478
479
|
]),
|
|
479
480
|
key: "0"
|
|
480
481
|
} : void 0
|
|
481
482
|
]), 1032, ["group", "selected-value", "highlighted-key", "option-id-prefix", "onHover"]))), 128))
|
|
482
|
-
], 42,
|
|
483
|
-
|
|
484
|
-
D(
|
|
485
|
-
|
|
483
|
+
], 42, tt),
|
|
484
|
+
l.$slots.footer || e.effortOptions.length > 0 ? (p(), b("div", lt, [
|
|
485
|
+
D(l.$slots, "footer", j(N(k.value)), () => [
|
|
486
|
+
W(Fe, {
|
|
486
487
|
options: e.effortOptions,
|
|
487
488
|
value: e.effortValue,
|
|
488
489
|
label: e.effortLabel,
|
|
489
490
|
disabled: e.effortDisabled,
|
|
490
|
-
onSelect:
|
|
491
|
+
onSelect: x[1] || (x[1] = (M) => l.$emit("select-effort", M))
|
|
491
492
|
}, null, 8, ["options", "value", "label", "disabled"])
|
|
492
493
|
])
|
|
493
|
-
])) :
|
|
494
|
+
])) : B("", !0)
|
|
494
495
|
], 38));
|
|
495
496
|
}
|
|
496
|
-
}),
|
|
497
|
+
}), nt = ["title", "disabled", "aria-label", "aria-expanded", "aria-controls"], at = { class: "tr-model-selector__trigger-content" }, rt = ["src"], it = { class: "tr-model-selector__trigger-label" }, st = {
|
|
497
498
|
key: 2,
|
|
498
499
|
class: "tr-model-selector__trigger-effort"
|
|
499
|
-
},
|
|
500
|
+
}, ut = /* @__PURE__ */ X({
|
|
500
501
|
name: "TrModelSelectorTrigger",
|
|
501
502
|
__name: "ModelSelectorTrigger",
|
|
502
503
|
props: {
|
|
@@ -511,218 +512,217 @@ const Re = { class: "tr-model-selector__effort" }, Ke = { class: "tr-model-selec
|
|
|
511
512
|
},
|
|
512
513
|
emits: ["click", "enter"],
|
|
513
514
|
setup(e, { emit: a }) {
|
|
514
|
-
const
|
|
515
|
-
function f(
|
|
516
|
-
|
|
515
|
+
const o = e, t = g(() => o.effortLabel ? `${o.label} · ${o.effortLabel}` : o.label), c = a;
|
|
516
|
+
function f(u) {
|
|
517
|
+
u.key === "Enter" && !u.defaultPrevented && (u.preventDefault(), c("enter", u));
|
|
517
518
|
}
|
|
518
|
-
return (
|
|
519
|
+
return (u, v) => (p(), b("button", {
|
|
519
520
|
type: "button",
|
|
520
|
-
class:
|
|
521
|
-
title:
|
|
521
|
+
class: Q(["tr-model-selector__trigger", [`tr-model-selector__trigger--${e.variant}`, `tr-model-selector__trigger--${e.size}`, { "is-open": e.open }]]),
|
|
522
|
+
title: t.value,
|
|
522
523
|
disabled: e.disabled,
|
|
523
|
-
"aria-label":
|
|
524
|
+
"aria-label": t.value,
|
|
524
525
|
"aria-expanded": e.open,
|
|
525
526
|
"aria-controls": e.controlsId,
|
|
526
527
|
"aria-haspopup": "listbox",
|
|
527
|
-
onClick:
|
|
528
|
+
onClick: v[0] || (v[0] = (h) => u.$emit("click", h)),
|
|
528
529
|
onKeydown: f
|
|
529
530
|
}, [
|
|
530
|
-
D(
|
|
531
|
-
|
|
531
|
+
D(u.$slots, "default", {}, () => [
|
|
532
|
+
z("span", at, [
|
|
532
533
|
typeof e.icon == "string" ? (p(), b("img", {
|
|
533
534
|
key: 0,
|
|
534
535
|
src: e.icon,
|
|
535
536
|
class: "tr-model-selector__trigger-icon",
|
|
536
537
|
alt: "",
|
|
537
538
|
"aria-hidden": "true"
|
|
538
|
-
}, null, 8,
|
|
539
|
+
}, null, 8, rt)) : e.icon ? (p(), _(re(e.icon), {
|
|
539
540
|
key: 1,
|
|
540
541
|
class: "tr-model-selector__trigger-icon",
|
|
541
542
|
"aria-hidden": "true",
|
|
542
543
|
focusable: "false"
|
|
543
|
-
})) :
|
|
544
|
-
|
|
545
|
-
e.effortLabel ? (p(), b("span",
|
|
544
|
+
})) : B("", !0),
|
|
545
|
+
z("span", it, q(e.label), 1),
|
|
546
|
+
e.effortLabel ? (p(), b("span", st, q(e.effortLabel), 1)) : B("", !0)
|
|
546
547
|
]),
|
|
547
|
-
|
|
548
|
+
W(P(Oe), {
|
|
548
549
|
class: "tr-model-selector__trigger-chevron",
|
|
549
550
|
"aria-hidden": "true",
|
|
550
551
|
focusable: "false"
|
|
551
552
|
})
|
|
552
553
|
])
|
|
553
|
-
], 42,
|
|
554
|
+
], 42, nt));
|
|
554
555
|
}
|
|
555
556
|
});
|
|
556
|
-
function
|
|
557
|
-
const a = e.controlled,
|
|
558
|
-
function f(
|
|
559
|
-
if (Object.is(
|
|
557
|
+
function ct(e) {
|
|
558
|
+
const a = e.controlled, o = V(e.defaultValue), t = g(() => a ? e.value() ?? null : o.value), c = g(() => e.efforts().find((u) => u.value === t.value) ?? null);
|
|
559
|
+
function f(u) {
|
|
560
|
+
if (Object.is(t.value, u))
|
|
560
561
|
return !1;
|
|
561
|
-
if (
|
|
562
|
-
const
|
|
563
|
-
if (!
|
|
562
|
+
if (u !== null) {
|
|
563
|
+
const v = e.efforts().find((h) => h.value === u);
|
|
564
|
+
if (!v || v.disabled)
|
|
564
565
|
return !1;
|
|
565
566
|
}
|
|
566
|
-
return a || (
|
|
567
|
+
return a || (o.value = u), e.onUpdateValue(u), !0;
|
|
567
568
|
}
|
|
568
569
|
return {
|
|
569
|
-
value:
|
|
570
|
-
activeOption:
|
|
570
|
+
value: t,
|
|
571
|
+
activeOption: c,
|
|
571
572
|
setValue: f
|
|
572
573
|
};
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
-
var
|
|
576
|
-
if ((((
|
|
575
|
+
function ae(e, a) {
|
|
576
|
+
var c, f;
|
|
577
|
+
if ((((c = e.composedPath) == null ? void 0 : c.call(e)) ?? []).includes(a))
|
|
577
578
|
return !0;
|
|
578
|
-
const
|
|
579
|
-
return !!(
|
|
579
|
+
const t = (f = a.ownerDocument.defaultView) == null ? void 0 : f.Node;
|
|
580
|
+
return !!(t && e.target instanceof t && a.contains(e.target));
|
|
580
581
|
}
|
|
581
|
-
function
|
|
582
|
-
const a = V(!1),
|
|
582
|
+
function dt(e) {
|
|
583
|
+
const a = V(!1), o = J(
|
|
583
584
|
() => [
|
|
584
585
|
e.open(),
|
|
585
586
|
e.referenceEl.value,
|
|
586
587
|
e.floatingEl.value,
|
|
587
588
|
e.placement(),
|
|
588
|
-
e.strategy(),
|
|
589
589
|
e.offset(),
|
|
590
590
|
e.teleportTarget()
|
|
591
591
|
],
|
|
592
|
-
async ([
|
|
593
|
-
if (a.value = !1, !
|
|
592
|
+
async ([t, c, f, u, v, h], r, i) => {
|
|
593
|
+
if (a.value = !1, !t || !c || !f)
|
|
594
594
|
return;
|
|
595
|
-
const
|
|
596
|
-
let
|
|
597
|
-
const
|
|
598
|
-
|
|
595
|
+
const s = c, d = f;
|
|
596
|
+
let S = !0, k = 0;
|
|
597
|
+
const y = {}, $ = s.ownerDocument, O = (w) => {
|
|
598
|
+
ae(w, s) || ae(w, d) || e.onOutsidePointerDown(w);
|
|
599
599
|
};
|
|
600
|
-
|
|
601
|
-
var
|
|
602
|
-
|
|
600
|
+
$.addEventListener("pointerdown", O, !0), i(() => {
|
|
601
|
+
var w;
|
|
602
|
+
S = !1, k += 1, (w = y.current) == null || w.call(y), $.removeEventListener("pointerdown", O, !0), a.value = !1;
|
|
603
603
|
});
|
|
604
|
-
async function
|
|
605
|
-
var
|
|
606
|
-
const
|
|
604
|
+
async function K() {
|
|
605
|
+
var G;
|
|
606
|
+
const w = ++k;
|
|
607
607
|
try {
|
|
608
|
-
const
|
|
609
|
-
placement:
|
|
610
|
-
strategy:
|
|
608
|
+
const T = await Me(s, d, {
|
|
609
|
+
placement: u,
|
|
610
|
+
strategy: "fixed",
|
|
611
611
|
middleware: [
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
612
|
+
Pe(v),
|
|
613
|
+
Ve({ padding: 8 }),
|
|
614
|
+
Te({ padding: 8 }),
|
|
615
|
+
Ce({
|
|
616
616
|
padding: 8,
|
|
617
|
-
apply({ availableHeight:
|
|
618
|
-
const
|
|
619
|
-
|
|
617
|
+
apply({ availableHeight: M, availableWidth: I, rects: Y, elements: F }) {
|
|
618
|
+
const A = Math.min(Y.reference.width, Math.max(0, I));
|
|
619
|
+
F.floating.style.minWidth = `${Math.round(A)}px`, F.floating.style.maxWidth = `${Math.max(0, Math.floor(I))}px`, F.floating.style.setProperty(
|
|
620
620
|
"--tr-model-selector-available-height",
|
|
621
|
-
`${Math.max(0, Math.floor(
|
|
622
|
-
),
|
|
621
|
+
`${Math.max(0, Math.floor(M))}px`
|
|
622
|
+
), F.floating.style.setProperty(
|
|
623
623
|
"--tr-model-selector-available-width",
|
|
624
|
-
`${Math.max(0, Math.floor(
|
|
624
|
+
`${Math.max(0, Math.floor(I))}px`
|
|
625
625
|
);
|
|
626
626
|
}
|
|
627
627
|
})
|
|
628
628
|
]
|
|
629
629
|
});
|
|
630
|
-
if (!
|
|
630
|
+
if (!S || w !== k || !e.open() || e.referenceEl.value !== s || e.floatingEl.value !== d)
|
|
631
631
|
return;
|
|
632
|
-
const
|
|
633
|
-
Object.assign(
|
|
634
|
-
left: `${
|
|
635
|
-
top: `${
|
|
632
|
+
const R = ((G = $.defaultView) == null ? void 0 : G.devicePixelRatio) || 1, l = Math.round(T.x * R) / R, x = Math.round(T.y * R) / R;
|
|
633
|
+
Object.assign(d.style, {
|
|
634
|
+
left: `${l}px`,
|
|
635
|
+
top: `${x}px`
|
|
636
636
|
}), a.value = !0;
|
|
637
637
|
} catch {
|
|
638
|
-
|
|
638
|
+
S && w === k && (a.value = !1);
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
-
await Z(), !(!
|
|
642
|
-
|
|
641
|
+
await Z(), !(!S || !e.open()) && (y.current = xe(s, d, () => {
|
|
642
|
+
K();
|
|
643
643
|
}));
|
|
644
644
|
},
|
|
645
645
|
{ flush: "post", immediate: !0 }
|
|
646
646
|
);
|
|
647
|
-
return
|
|
648
|
-
|
|
647
|
+
return ye(() => {
|
|
648
|
+
o();
|
|
649
649
|
}), {
|
|
650
650
|
isPositioned: a
|
|
651
651
|
};
|
|
652
652
|
}
|
|
653
|
-
function
|
|
654
|
-
const a = e.valueControlled,
|
|
655
|
-
function
|
|
656
|
-
return Object.is(f.value,
|
|
653
|
+
function ft(e) {
|
|
654
|
+
const a = e.valueControlled, o = e.openControlled, t = V(e.defaultValue), c = V(e.defaultOpen), f = g(() => a ? e.value() ?? null : t.value), u = g(() => o ? !!e.open() : c.value);
|
|
655
|
+
function v(r) {
|
|
656
|
+
return Object.is(f.value, r) ? !1 : (a || (t.value = r), e.onUpdateValue(r), !0);
|
|
657
657
|
}
|
|
658
|
-
function
|
|
659
|
-
return
|
|
658
|
+
function h(r) {
|
|
659
|
+
return u.value === r ? !1 : (o || (c.value = r), e.onUpdateOpen(r), !0);
|
|
660
660
|
}
|
|
661
661
|
return {
|
|
662
662
|
value: f,
|
|
663
|
-
open:
|
|
664
|
-
setValue:
|
|
665
|
-
setOpen:
|
|
663
|
+
open: u,
|
|
664
|
+
setValue: v,
|
|
665
|
+
setOpen: h
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
|
-
const
|
|
668
|
+
const ht = Object.freeze([
|
|
669
669
|
Object.freeze({ value: "low", label: "Low" }),
|
|
670
670
|
Object.freeze({ value: "medium", label: "Medium" }),
|
|
671
671
|
Object.freeze({ value: "high", label: "High" })
|
|
672
672
|
]);
|
|
673
|
-
function
|
|
673
|
+
function vt(e) {
|
|
674
674
|
if (!e)
|
|
675
675
|
return [];
|
|
676
676
|
if (e === !0)
|
|
677
|
-
return
|
|
678
|
-
const a = /* @__PURE__ */ new Set(),
|
|
679
|
-
for (const
|
|
680
|
-
a.has(
|
|
681
|
-
return
|
|
677
|
+
return ht;
|
|
678
|
+
const a = /* @__PURE__ */ new Set(), o = [];
|
|
679
|
+
for (const t of e)
|
|
680
|
+
a.has(t.value) || (a.add(t.value), o.push(t));
|
|
681
|
+
return o;
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function mt(e) {
|
|
684
684
|
if (!e || e === !0)
|
|
685
685
|
return [];
|
|
686
|
-
const a = /* @__PURE__ */ new Set(),
|
|
687
|
-
for (const
|
|
688
|
-
a.has(
|
|
689
|
-
return Array.from(
|
|
686
|
+
const a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
687
|
+
for (const t of e)
|
|
688
|
+
a.has(t.value) ? o.add(t.value) : a.add(t.value);
|
|
689
|
+
return Array.from(o);
|
|
690
690
|
}
|
|
691
|
-
const
|
|
692
|
-
function
|
|
691
|
+
const gt = "__tr-model-selector-ungrouped__";
|
|
692
|
+
function le(e) {
|
|
693
693
|
return (e == null ? void 0 : e.trim()) ?? "";
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function pt(e) {
|
|
696
696
|
return e.filter((a) => !!(a && a.trim())).join(" ").toLocaleLowerCase();
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
const a = /* @__PURE__ */ new Set(),
|
|
700
|
-
return e.forEach((
|
|
701
|
-
if (a.has(
|
|
698
|
+
function yt(e) {
|
|
699
|
+
const a = /* @__PURE__ */ new Set(), o = [];
|
|
700
|
+
return e.forEach((t, c) => {
|
|
701
|
+
if (a.has(t.value))
|
|
702
702
|
return;
|
|
703
|
-
a.add(
|
|
704
|
-
const f =
|
|
705
|
-
|
|
706
|
-
key: `value:${
|
|
707
|
-
index:
|
|
708
|
-
value:
|
|
703
|
+
a.add(t.value);
|
|
704
|
+
const f = le(t.label) || t.value, u = le(t.description) || void 0, v = le(t.group), h = v ? `group:${v}` : gt, r = typeof t.icon == "string" ? t.icon : t.icon ? be(t.icon) : void 0;
|
|
705
|
+
o.push({
|
|
706
|
+
key: `value:${t.value}`,
|
|
707
|
+
index: c,
|
|
708
|
+
value: t.value,
|
|
709
709
|
label: f,
|
|
710
|
-
description:
|
|
711
|
-
icon:
|
|
712
|
-
disabled: !!
|
|
713
|
-
groupKey:
|
|
714
|
-
searchText:
|
|
715
|
-
raw:
|
|
710
|
+
description: u,
|
|
711
|
+
icon: r,
|
|
712
|
+
disabled: !!t.disabled,
|
|
713
|
+
groupKey: h,
|
|
714
|
+
searchText: pt([f, t.value, u, v]),
|
|
715
|
+
raw: t
|
|
716
716
|
});
|
|
717
|
-
}),
|
|
717
|
+
}), o;
|
|
718
718
|
}
|
|
719
|
-
function
|
|
720
|
-
const a = /* @__PURE__ */ new Set(),
|
|
721
|
-
return e.forEach((
|
|
722
|
-
a.has(
|
|
723
|
-
}), [...
|
|
719
|
+
function bt(e) {
|
|
720
|
+
const a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
721
|
+
return e.forEach((t) => {
|
|
722
|
+
a.has(t.value) ? o.add(t.value) : a.add(t.value);
|
|
723
|
+
}), [...o];
|
|
724
724
|
}
|
|
725
|
-
const
|
|
725
|
+
const wt = { class: "tr-model-selector__dropdown-surface" }, te = /* @__PURE__ */ X({
|
|
726
726
|
name: "TrModelSelector",
|
|
727
727
|
__name: "index",
|
|
728
728
|
props: {
|
|
@@ -744,266 +744,261 @@ const kt = { class: "tr-model-selector__dropdown-surface" }, le = /* @__PURE__ *
|
|
|
744
744
|
size: { default: "normal" },
|
|
745
745
|
placement: { default: "bottom-start" },
|
|
746
746
|
offset: { default: 8 },
|
|
747
|
-
appendTo: {
|
|
747
|
+
appendTo: {},
|
|
748
748
|
panelClass: {},
|
|
749
749
|
reasoningEffortLabel: { default: "Thinking" }
|
|
750
750
|
},
|
|
751
751
|
emits: ["update:modelValue", "change", "update:reasoningEffort", "reasoning-effort-change", "update:open"],
|
|
752
752
|
setup(e, { emit: a }) {
|
|
753
|
-
const
|
|
753
|
+
const o = e, t = a, c = we(), f = (c == null ? void 0 : c.vnode.props) ?? {}, u = (...n) => n.some((m) => Object.prototype.hasOwnProperty.call(f, m)), v = `tr-model-selector-${Ie()}`, h = `${v}-listbox`, r = V(null), i = V(null), s = V(!1), d = V(null), S = De(r), k = g(() => {
|
|
754
754
|
var C, L;
|
|
755
|
-
if (!
|
|
755
|
+
if (!s.value)
|
|
756
756
|
return null;
|
|
757
|
-
const
|
|
758
|
-
if (!
|
|
759
|
-
return
|
|
760
|
-
if (typeof
|
|
761
|
-
return
|
|
762
|
-
if (
|
|
763
|
-
return
|
|
764
|
-
const
|
|
757
|
+
const n = S.value, m = o.appendTo;
|
|
758
|
+
if (!m)
|
|
759
|
+
return n;
|
|
760
|
+
if (typeof m != "string")
|
|
761
|
+
return m;
|
|
762
|
+
if (m === "body" && n === ((C = r.value) == null ? void 0 : C.ownerDocument.body))
|
|
763
|
+
return n;
|
|
764
|
+
const E = n;
|
|
765
765
|
try {
|
|
766
|
-
return ((L =
|
|
766
|
+
return ((L = E.querySelector) == null ? void 0 : L.call(E, m)) ?? n;
|
|
767
767
|
} catch {
|
|
768
|
-
return
|
|
768
|
+
return n;
|
|
769
769
|
}
|
|
770
|
-
}),
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
g(() => wt(n.models));
|
|
785
|
-
const T = g(() => R.value.find((o) => o.value === E.value.value) ?? null), O = g(() => {
|
|
786
|
-
var o;
|
|
787
|
-
return mt((o = T.value) == null ? void 0 : o.raw.reasoningEfforts);
|
|
770
|
+
}), y = ft({
|
|
771
|
+
value: () => o.modelValue,
|
|
772
|
+
defaultValue: o.defaultValue,
|
|
773
|
+
valueControlled: u("modelValue", "model-value"),
|
|
774
|
+
open: () => o.open,
|
|
775
|
+
defaultOpen: o.disabled ? !1 : o.defaultOpen,
|
|
776
|
+
openControlled: u("open"),
|
|
777
|
+
onUpdateValue: (n) => t("update:modelValue", n),
|
|
778
|
+
onUpdateOpen: (n) => t("update:open", n)
|
|
779
|
+
}), $ = g(() => yt(o.models));
|
|
780
|
+
g(() => bt(o.models));
|
|
781
|
+
const O = g(() => $.value.find((n) => n.value === y.value.value) ?? null), K = g(() => {
|
|
782
|
+
var n;
|
|
783
|
+
return vt((n = O.value) == null ? void 0 : n.raw.reasoningEfforts);
|
|
788
784
|
});
|
|
789
785
|
g(() => {
|
|
790
|
-
var
|
|
791
|
-
return
|
|
786
|
+
var n;
|
|
787
|
+
return mt((n = O.value) == null ? void 0 : n.raw.reasoningEfforts);
|
|
792
788
|
});
|
|
793
|
-
const
|
|
794
|
-
value: () =>
|
|
795
|
-
defaultValue:
|
|
796
|
-
efforts: () =>
|
|
797
|
-
controlled:
|
|
798
|
-
onUpdateValue: (
|
|
799
|
-
}),
|
|
800
|
-
var
|
|
801
|
-
return ((
|
|
802
|
-
}),
|
|
803
|
-
var
|
|
804
|
-
return ((
|
|
805
|
-
}),
|
|
806
|
-
var
|
|
789
|
+
const w = ct({
|
|
790
|
+
value: () => o.reasoningEffort,
|
|
791
|
+
defaultValue: o.defaultReasoningEffort,
|
|
792
|
+
efforts: () => K.value,
|
|
793
|
+
controlled: u("reasoningEffort", "reasoning-effort"),
|
|
794
|
+
onUpdateValue: (n) => t("update:reasoningEffort", n)
|
|
795
|
+
}), G = g(() => {
|
|
796
|
+
var n;
|
|
797
|
+
return ((n = w.activeOption.value) == null ? void 0 : n.value) ?? null;
|
|
798
|
+
}), T = g(() => y.open.value && !o.disabled), R = g(() => {
|
|
799
|
+
var n;
|
|
800
|
+
return ((n = O.value) == null ? void 0 : n.label) ?? o.placeholder;
|
|
801
|
+
}), l = g(() => {
|
|
802
|
+
var n;
|
|
807
803
|
return {
|
|
808
|
-
option: ((
|
|
809
|
-
label:
|
|
810
|
-
open:
|
|
811
|
-
reasoningEffortOption:
|
|
804
|
+
option: ((n = O.value) == null ? void 0 : n.raw) ?? null,
|
|
805
|
+
label: R.value,
|
|
806
|
+
open: T.value,
|
|
807
|
+
reasoningEffortOption: w.activeOption.value
|
|
812
808
|
};
|
|
813
|
-
}),
|
|
814
|
-
var
|
|
809
|
+
}), x = g(() => {
|
|
810
|
+
var n;
|
|
815
811
|
return {
|
|
816
|
-
option: ((
|
|
817
|
-
close:
|
|
812
|
+
option: ((n = O.value) == null ? void 0 : n.raw) ?? null,
|
|
813
|
+
close: he
|
|
818
814
|
};
|
|
819
815
|
});
|
|
820
|
-
function
|
|
821
|
-
var
|
|
822
|
-
(
|
|
816
|
+
function M() {
|
|
817
|
+
var n, m;
|
|
818
|
+
(m = (n = r.value) == null ? void 0 : n.querySelector(".tr-model-selector__trigger")) == null || m.focus({ preventScroll: !0 });
|
|
823
819
|
}
|
|
824
|
-
function
|
|
825
|
-
var
|
|
826
|
-
let
|
|
827
|
-
for (; (
|
|
828
|
-
|
|
829
|
-
return
|
|
820
|
+
function I() {
|
|
821
|
+
var m, E;
|
|
822
|
+
let n = ((m = r.value) == null ? void 0 : m.ownerDocument.activeElement) ?? null;
|
|
823
|
+
for (; (E = n == null ? void 0 : n.shadowRoot) != null && E.activeElement; )
|
|
824
|
+
n = n.shadowRoot.activeElement;
|
|
825
|
+
return n;
|
|
830
826
|
}
|
|
831
|
-
function
|
|
832
|
-
var
|
|
833
|
-
const
|
|
834
|
-
return !!(
|
|
827
|
+
function Y() {
|
|
828
|
+
var m;
|
|
829
|
+
const n = I();
|
|
830
|
+
return !!(n && ((m = i.value) != null && m.contains(n)));
|
|
835
831
|
}
|
|
836
|
-
function
|
|
837
|
-
|
|
832
|
+
function F() {
|
|
833
|
+
o.disabled || y.setOpen(!0);
|
|
838
834
|
}
|
|
839
|
-
function
|
|
835
|
+
function A(n) {
|
|
840
836
|
var L;
|
|
841
|
-
if (!
|
|
837
|
+
if (!T.value || d.value !== null)
|
|
842
838
|
return;
|
|
843
|
-
if (
|
|
844
|
-
|
|
839
|
+
if (d.value = n, !y.setOpen(!1)) {
|
|
840
|
+
d.value = null;
|
|
845
841
|
return;
|
|
846
842
|
}
|
|
847
|
-
const
|
|
848
|
-
|
|
843
|
+
const E = () => {
|
|
844
|
+
T.value && d.value === n && (d.value = null);
|
|
849
845
|
}, C = (L = r.value) == null ? void 0 : L.ownerDocument.defaultView;
|
|
850
|
-
C ? C.setTimeout(
|
|
846
|
+
C ? C.setTimeout(E, 0) : Z().then(E);
|
|
851
847
|
}
|
|
852
|
-
function
|
|
853
|
-
|
|
848
|
+
function ue() {
|
|
849
|
+
T.value ? A(!1) : F();
|
|
854
850
|
}
|
|
855
|
-
function
|
|
856
|
-
|
|
851
|
+
function ce() {
|
|
852
|
+
F();
|
|
857
853
|
}
|
|
858
|
-
function
|
|
859
|
-
const
|
|
860
|
-
if (!
|
|
854
|
+
function de(n) {
|
|
855
|
+
const m = $.value.find((C) => C.value === n.value);
|
|
856
|
+
if (!m || m.disabled)
|
|
861
857
|
return;
|
|
862
|
-
|
|
858
|
+
y.setValue(m.value) && t("change", m.raw), o.closeOnSelect && A(!0);
|
|
863
859
|
}
|
|
864
|
-
function
|
|
860
|
+
function fe(n) {
|
|
865
861
|
var C;
|
|
866
|
-
if (
|
|
862
|
+
if (o.disabled || (C = O.value) != null && C.disabled)
|
|
867
863
|
return;
|
|
868
|
-
const
|
|
869
|
-
|
|
864
|
+
const m = n === null ? null : K.value.find((L) => L.value === n) ?? null;
|
|
865
|
+
w.setValue(n) && t("reasoning-effort-change", m);
|
|
870
866
|
}
|
|
871
|
-
function
|
|
872
|
-
|
|
867
|
+
function he() {
|
|
868
|
+
A(!0);
|
|
873
869
|
}
|
|
874
|
-
const { isPositioned:
|
|
870
|
+
const { isPositioned: ve } = dt({
|
|
875
871
|
referenceEl: r,
|
|
876
|
-
floatingEl:
|
|
877
|
-
open: () =>
|
|
878
|
-
placement: () =>
|
|
879
|
-
|
|
880
|
-
offset: () => n.offset,
|
|
872
|
+
floatingEl: i,
|
|
873
|
+
open: () => T.value,
|
|
874
|
+
placement: () => o.placement,
|
|
875
|
+
offset: () => o.offset,
|
|
881
876
|
teleportTarget: () => k.value,
|
|
882
|
-
onOutsidePointerDown: () =>
|
|
877
|
+
onOutsidePointerDown: () => A(!1)
|
|
883
878
|
});
|
|
884
|
-
return
|
|
885
|
-
() =>
|
|
886
|
-
(
|
|
887
|
-
|
|
879
|
+
return J(
|
|
880
|
+
() => o.disabled,
|
|
881
|
+
(n) => {
|
|
882
|
+
n && y.open.value && (d.value = !1, y.setOpen(!1));
|
|
888
883
|
}
|
|
889
|
-
),
|
|
890
|
-
|
|
891
|
-
async (
|
|
892
|
-
if (!
|
|
893
|
-
if (
|
|
894
|
-
const
|
|
895
|
-
|
|
884
|
+
), J(
|
|
885
|
+
T,
|
|
886
|
+
async (n, m) => {
|
|
887
|
+
if (!n) {
|
|
888
|
+
if (m) {
|
|
889
|
+
const E = d.value ?? Y();
|
|
890
|
+
d.value = null, E && (await Z(), M());
|
|
896
891
|
}
|
|
897
892
|
return;
|
|
898
893
|
}
|
|
899
894
|
},
|
|
900
895
|
{ immediate: !0 }
|
|
901
|
-
),
|
|
902
|
-
|
|
903
|
-
}), (
|
|
904
|
-
var
|
|
896
|
+
), se(() => {
|
|
897
|
+
s.value = !0;
|
|
898
|
+
}), (n, m) => {
|
|
899
|
+
var E, C, L;
|
|
905
900
|
return p(), b("div", {
|
|
906
|
-
class:
|
|
901
|
+
class: Q(["tr-model-selector", [`tr-model-selector--${e.variant}`, `tr-model-selector--${e.size}`]])
|
|
907
902
|
}, [
|
|
908
|
-
|
|
903
|
+
z("span", {
|
|
909
904
|
ref_key: "referenceEl",
|
|
910
905
|
ref: r,
|
|
911
906
|
class: "tr-model-selector__anchor"
|
|
912
907
|
}, [
|
|
913
|
-
|
|
914
|
-
open:
|
|
908
|
+
W(ut, {
|
|
909
|
+
open: T.value,
|
|
915
910
|
disabled: e.disabled,
|
|
916
|
-
label:
|
|
917
|
-
"effort-label": (
|
|
918
|
-
icon: (C =
|
|
919
|
-
"controls-id":
|
|
911
|
+
label: R.value,
|
|
912
|
+
"effort-label": (E = P(w).activeOption.value) == null ? void 0 : E.label,
|
|
913
|
+
icon: (C = O.value) == null ? void 0 : C.icon,
|
|
914
|
+
"controls-id": h,
|
|
920
915
|
variant: e.variant,
|
|
921
916
|
size: e.size,
|
|
922
|
-
onClick:
|
|
923
|
-
onEnter:
|
|
924
|
-
},
|
|
925
|
-
|
|
917
|
+
onClick: ue,
|
|
918
|
+
onEnter: ce
|
|
919
|
+
}, ee({ _: 2 }, [
|
|
920
|
+
n.$slots.trigger ? {
|
|
926
921
|
name: "default",
|
|
927
|
-
fn:
|
|
928
|
-
D(
|
|
922
|
+
fn: U(() => [
|
|
923
|
+
D(n.$slots, "trigger", j(N(l.value)))
|
|
929
924
|
]),
|
|
930
925
|
key: "0"
|
|
931
926
|
} : void 0
|
|
932
927
|
]), 1032, ["open", "disabled", "label", "effort-label", "icon", "variant", "size"])
|
|
933
928
|
], 512),
|
|
934
|
-
k.value ? (p(), _(
|
|
929
|
+
k.value ? (p(), _(ke, {
|
|
935
930
|
key: 0,
|
|
936
931
|
to: k.value
|
|
937
932
|
}, [
|
|
938
|
-
|
|
933
|
+
T.value ? (p(), b("div", {
|
|
939
934
|
key: 0,
|
|
940
935
|
ref_key: "floatingEl",
|
|
941
|
-
ref:
|
|
942
|
-
class:
|
|
936
|
+
ref: i,
|
|
937
|
+
class: Q(["tr-model-selector__dropdown-wrapper", { "is-positioned": P(ve) }])
|
|
943
938
|
}, [
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
options:
|
|
947
|
-
"selected-value": P(
|
|
939
|
+
z("div", wt, [
|
|
940
|
+
W(ot, {
|
|
941
|
+
options: $.value,
|
|
942
|
+
"selected-value": P(y).value.value,
|
|
948
943
|
searchable: e.searchable,
|
|
949
944
|
"filter-method": e.filterMethod,
|
|
950
|
-
"listbox-id":
|
|
951
|
-
"option-id-prefix":
|
|
945
|
+
"listbox-id": h,
|
|
946
|
+
"option-id-prefix": v,
|
|
952
947
|
placeholder: e.placeholder,
|
|
953
948
|
"search-placeholder": e.searchPlaceholder,
|
|
954
949
|
"empty-text": e.emptyText,
|
|
955
|
-
"effort-options":
|
|
956
|
-
"effort-value":
|
|
950
|
+
"effort-options": K.value,
|
|
951
|
+
"effort-value": G.value,
|
|
957
952
|
"effort-label": e.reasoningEffortLabel,
|
|
958
|
-
"effort-disabled": !!((L =
|
|
953
|
+
"effort-disabled": !!((L = O.value) != null && L.disabled),
|
|
959
954
|
size: e.size,
|
|
960
955
|
"panel-class": e.panelClass,
|
|
961
|
-
"slot-context":
|
|
962
|
-
onSelect:
|
|
963
|
-
onSelectEffort:
|
|
964
|
-
onClose:
|
|
965
|
-
},
|
|
966
|
-
|
|
956
|
+
"slot-context": x.value,
|
|
957
|
+
onSelect: de,
|
|
958
|
+
onSelectEffort: fe,
|
|
959
|
+
onClose: A
|
|
960
|
+
}, ee({ _: 2 }, [
|
|
961
|
+
n.$slots.header ? {
|
|
967
962
|
name: "header",
|
|
968
|
-
fn:
|
|
969
|
-
D(
|
|
963
|
+
fn: U((H) => [
|
|
964
|
+
D(n.$slots, "header", j(N(H)))
|
|
970
965
|
]),
|
|
971
966
|
key: "0"
|
|
972
967
|
} : void 0,
|
|
973
|
-
|
|
968
|
+
n.$slots.item ? {
|
|
974
969
|
name: "item",
|
|
975
|
-
fn:
|
|
976
|
-
D(
|
|
970
|
+
fn: U((H) => [
|
|
971
|
+
D(n.$slots, "item", j(N(H)))
|
|
977
972
|
]),
|
|
978
973
|
key: "1"
|
|
979
974
|
} : void 0,
|
|
980
|
-
|
|
975
|
+
n.$slots.empty ? {
|
|
981
976
|
name: "empty",
|
|
982
|
-
fn:
|
|
983
|
-
D(
|
|
977
|
+
fn: U((H) => [
|
|
978
|
+
D(n.$slots, "empty", j(N(H)))
|
|
984
979
|
]),
|
|
985
980
|
key: "2"
|
|
986
981
|
} : void 0,
|
|
987
|
-
|
|
982
|
+
n.$slots.footer ? {
|
|
988
983
|
name: "footer",
|
|
989
|
-
fn:
|
|
990
|
-
D(
|
|
984
|
+
fn: U((H) => [
|
|
985
|
+
D(n.$slots, "footer", j(N(H)))
|
|
991
986
|
]),
|
|
992
987
|
key: "3"
|
|
993
988
|
} : void 0
|
|
994
989
|
]), 1032, ["options", "selected-value", "searchable", "filter-method", "placeholder", "search-placeholder", "empty-text", "effort-options", "effort-value", "effort-label", "effort-disabled", "size", "panel-class", "slot-context"])
|
|
995
990
|
])
|
|
996
|
-
], 2)) :
|
|
997
|
-
], 8, ["to"])) :
|
|
991
|
+
], 2)) : B("", !0)
|
|
992
|
+
], 8, ["to"])) : B("", !0)
|
|
998
993
|
], 2);
|
|
999
994
|
};
|
|
1000
995
|
}
|
|
1001
996
|
});
|
|
1002
|
-
|
|
1003
|
-
const
|
|
1004
|
-
e.component(
|
|
997
|
+
te.name = "TrModelSelector";
|
|
998
|
+
const kt = function(e) {
|
|
999
|
+
e.component(te.name, te);
|
|
1005
1000
|
};
|
|
1006
|
-
|
|
1001
|
+
te.install = kt;
|
|
1007
1002
|
export {
|
|
1008
|
-
|
|
1003
|
+
te as default
|
|
1009
1004
|
};
|