@8wave/ai-elements 0.115.0-beta.34 → 0.115.0-beta.47
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/_chunks/{Agent-Cu04vBnd.js → Agent-D3cVY0pk.js} +121 -110
- package/dist/_chunks/Agent-D3cVY0pk.js.map +1 -0
- package/dist/_chunks/PkHeldImage-BtaPh0Jr.js +42 -0
- package/dist/_chunks/PkHeldImage-BtaPh0Jr.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-Qk9Tk_N7.js → PkStreamingMarkdown-DyvZ5xKK.js} +782 -741
- package/dist/_chunks/PkStreamingMarkdown-DyvZ5xKK.js.map +1 -0
- package/dist/_chunks/{PkToolRequestGeolocation-BoKYkQ-Z.js → PkToolRequestGeolocation-DjRmmYMk.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-BoKYkQ-Z.js.map → PkToolRequestGeolocation-DjRmmYMk.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-CDzpfBg6.js → PkToolRequestOAuthConnection-CJ8dg2RY.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-CDzpfBg6.js.map → PkToolRequestOAuthConnection-CJ8dg2RY.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-DB8JjN-b.js → PkToolShowArtifact-Bk-xmGxl.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-DB8JjN-b.js.map → PkToolShowArtifact-Bk-xmGxl.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-DHviNxDk.js → PkToolShowContactForm-B0o6CY0Q.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-DHviNxDk.js.map → PkToolShowContactForm-B0o6CY0Q.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-B-R9fh3R.js → PkToolShowForm-C4-KAKPL.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-B-R9fh3R.js.map → PkToolShowForm-C4-KAKPL.js.map} +1 -1
- package/dist/_chunks/PkToolShowImageGallery-Jdo7p2mZ.js +88 -0
- package/dist/_chunks/PkToolShowImageGallery-Jdo7p2mZ.js.map +1 -0
- package/dist/_chunks/PkToolShowProductList-Cfk865KB.js +72 -0
- package/dist/_chunks/PkToolShowProductList-Cfk865KB.js.map +1 -0
- package/dist/_chunks/{PkToolShowSources-CfZEfleZ.js → PkToolShowSources-qqUbdWzN.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-CfZEfleZ.js.map → PkToolShowSources-qqUbdWzN.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-DsB35hRR.js → PkToolShowSuggestedReply-Dk6Nu9cG.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-DsB35hRR.js.map → PkToolShowSuggestedReply-Dk6Nu9cG.js.map} +1 -1
- package/dist/_chunks/PkToolShowVideo-D07i4hVd.js +142 -0
- package/dist/_chunks/PkToolShowVideo-D07i4hVd.js.map +1 -0
- package/dist/_chunks/{PkToolShowWebPages-BOxbTe2X.js → PkToolShowWebPages-ksXRNsDK.js} +31 -24
- package/dist/_chunks/PkToolShowWebPages-ksXRNsDK.js.map +1 -0
- package/dist/_chunks/chatImagePolicy-B1iRRLAB.js +46 -0
- package/dist/_chunks/chatImagePolicy-B1iRRLAB.js.map +1 -0
- package/dist/_chunks/{markdown-_p-gd9w8.js → markdown-DOitQ2jz.js} +13 -13
- package/dist/_chunks/{markdown-_p-gd9w8.js.map → markdown-DOitQ2jz.js.map} +1 -1
- package/dist/ai-elements.es.js +1720 -1713
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-KbZm8GvA.js → Agent-C4p46YGt.js} +67 -56
- package/dist-vue/_chunks/Agent-C4p46YGt.js.map +1 -0
- package/dist-vue/_chunks/{Document-DCSWwcRE.js → Document-B9QaYHKT.js} +10 -10
- package/dist-vue/_chunks/{Document-DCSWwcRE.js.map → Document-B9QaYHKT.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbot-BkMe7zxp.js +275 -0
- package/dist-vue/_chunks/PkChatbot-BkMe7zxp.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-CO7-vlsZ.js → PkChatbotEmptyState-HElKT2OO.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-CO7-vlsZ.js.map → PkChatbotEmptyState-HElKT2OO.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-D8ykcHKJ.js → PkChatbotInput-BykvFqbm.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-D8ykcHKJ.js.map → PkChatbotInput-BykvFqbm.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-UT72KC_z.js → PkChatbotMessages-wH9wxc6Y.js} +19 -19
- package/dist-vue/_chunks/{PkChatbotMessages-UT72KC_z.js.map → PkChatbotMessages-wH9wxc6Y.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-CSVHe7DP.js → PkChatbotStepPayload-DY0AzM6s.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-CSVHe7DP.js.map → PkChatbotStepPayload-DY0AzM6s.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-ixte-rGB.js → PkChatbotStepToolDetail-AXtXQVQY.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-ixte-rGB.js.map → PkChatbotStepToolDetail-AXtXQVQY.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-Y6kQ00ui.js → PkChatbotSteps-B-yrfTat.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-Y6kQ00ui.js.map → PkChatbotSteps-B-yrfTat.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-D3PwREDw.js → PkChatbotViewChat-CCcMnVkM.js} +7 -7
- package/dist-vue/_chunks/{PkChatbotViewChat-D3PwREDw.js.map → PkChatbotViewChat-CCcMnVkM.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-dpwDFyr_.js → PkChatbotViewConversations-C9h_bBIc.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-dpwDFyr_.js.map → PkChatbotViewConversations-C9h_bBIc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-BStYLY2B.js → PkChatbotViewFiles-BkoXgGE6.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-BStYLY2B.js.map → PkChatbotViewFiles-BkoXgGE6.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-Brylm3We.js → PkChatbotViewProfile-CFR0B99Z.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-Brylm3We.js.map → PkChatbotViewProfile-CFR0B99Z.js.map} +1 -1
- package/dist-vue/_chunks/PkHeldImage-BqnlurT_.js +41 -0
- package/dist-vue/_chunks/PkHeldImage-BqnlurT_.js.map +1 -0
- package/dist-vue/_chunks/{PkStreamingMarkdown-CJlfq7ub.js → PkStreamingMarkdown-XJBXdSG2.js} +792 -780
- package/dist-vue/_chunks/PkStreamingMarkdown-XJBXdSG2.js.map +1 -0
- package/dist-vue/_chunks/{PkToolRequestGeolocation-C8sLjD6g.js → PkToolRequestGeolocation-DpvsFEga.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-C8sLjD6g.js.map → PkToolRequestGeolocation-DpvsFEga.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-rbjNi_l0.js → PkToolRequestOAuthConnection-DRefs-S1.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-rbjNi_l0.js.map → PkToolRequestOAuthConnection-DRefs-S1.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-hBmAAfsd.js → PkToolShowArtifact-BopCMkyZ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-hBmAAfsd.js.map → PkToolShowArtifact-BopCMkyZ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-BHsm_W2R.js → PkToolShowContactForm-C6F_DdBu.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-BHsm_W2R.js.map → PkToolShowContactForm-C6F_DdBu.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-De2XvRnq.js → PkToolShowDiagram-7-m7VrED.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-De2XvRnq.js.map → PkToolShowDiagram-7-m7VrED.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowEmail-D1mXZrT-.js → PkToolShowEmail-C591LR5N.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowEmail-D1mXZrT-.js.map → PkToolShowEmail-C591LR5N.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-Ce_GpcBt.js → PkToolShowForm-DEr8wDJi.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-Ce_GpcBt.js.map → PkToolShowForm-DEr8wDJi.js.map} +1 -1
- package/dist-vue/_chunks/PkToolShowImageGallery-D44wf_u3.js +88 -0
- package/dist-vue/_chunks/PkToolShowImageGallery-D44wf_u3.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowMessage-lNPZxw2v.js → PkToolShowMessage-CbXERPHI.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowMessage-lNPZxw2v.js.map → PkToolShowMessage-CbXERPHI.js.map} +1 -1
- package/dist-vue/_chunks/PkToolShowProductList-C6CVRUlD.js +72 -0
- package/dist-vue/_chunks/PkToolShowProductList-C6CVRUlD.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowSources-B1Nhrk7O.js → PkToolShowSources-DzUNanmK.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowSources-B1Nhrk7O.js.map → PkToolShowSources-DzUNanmK.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-Bmzygdww.js → PkToolShowSuggestedReply-DhNtI5gJ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-Bmzygdww.js.map → PkToolShowSuggestedReply-DhNtI5gJ.js.map} +1 -1
- package/dist-vue/_chunks/PkToolShowVideo-HbQzTMh5.js +141 -0
- package/dist-vue/_chunks/PkToolShowVideo-HbQzTMh5.js.map +1 -0
- package/dist-vue/_chunks/PkToolShowWebPages-Ct1HaCSq.js +86 -0
- package/dist-vue/_chunks/PkToolShowWebPages-Ct1HaCSq.js.map +1 -0
- package/dist-vue/_chunks/{PkUrl-E12f7rn_.js → PkUrl-CN1kkZiH.js} +2 -2
- package/dist-vue/_chunks/{PkUrl-E12f7rn_.js.map → PkUrl-CN1kkZiH.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-B_mkyrEl.js → createChatbotApiClient-B2PvUG07.js} +16 -16
- package/dist-vue/_chunks/{createChatbotApiClient-B_mkyrEl.js.map → createChatbotApiClient-B2PvUG07.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-DEELIJ89.js → useChatbotStore-Cj_UmNH3.js} +3 -3
- package/dist-vue/_chunks/{useChatbotStore-DEELIJ89.js.map → useChatbotStore-Cj_UmNH3.js.map} +1 -1
- package/dist-vue/_chunks/useShortUrlResolver-DI8ycJiO.js +71 -0
- package/dist-vue/_chunks/useShortUrlResolver-DI8ycJiO.js.map +1 -0
- package/dist-vue/_chunks/{utils-CtD8DCrq.js → utils-DXXzMVU3.js} +2 -2
- package/dist-vue/_chunks/{utils-CtD8DCrq.js.map → utils-DXXzMVU3.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +2 -0
- package/dist-vue/composables.js +11 -7
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +3444 -3400
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +12 -0
- package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +6 -2
- package/dist-vue/packages/components/src/chat/PkHeldImage.d.ts +21 -0
- package/dist-vue/packages/components/src/chat/chatImagePolicy.d.ts +55 -0
- package/dist-vue/packages/components/src/chat/index.d.ts +1 -0
- package/dist-vue/packages/components/src/chat/markdownHtml.d.ts +17 -1
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +6 -0
- package/dist-vue/packages/models/src/schema/Agent.d.ts +14 -0
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +2 -0
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +2 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/Agent-Cu04vBnd.js.map +0 -1
- package/dist/_chunks/PkStreamingMarkdown-Qk9Tk_N7.js.map +0 -1
- package/dist/_chunks/PkToolShowImageGallery-FubPWFCb.js +0 -75
- package/dist/_chunks/PkToolShowImageGallery-FubPWFCb.js.map +0 -1
- package/dist/_chunks/PkToolShowProductList-DFy2jxn4.js +0 -65
- package/dist/_chunks/PkToolShowProductList-DFy2jxn4.js.map +0 -1
- package/dist/_chunks/PkToolShowVideo-DClps9oP.js +0 -123
- package/dist/_chunks/PkToolShowVideo-DClps9oP.js.map +0 -1
- package/dist/_chunks/PkToolShowWebPages-BOxbTe2X.js.map +0 -1
- package/dist-vue/_chunks/Agent-KbZm8GvA.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-CRb-U8e3.js +0 -272
- package/dist-vue/_chunks/PkChatbot-CRb-U8e3.js.map +0 -1
- package/dist-vue/_chunks/PkStreamingMarkdown-CJlfq7ub.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowImageGallery-DmhZLnBk.js +0 -75
- package/dist-vue/_chunks/PkToolShowImageGallery-DmhZLnBk.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowProductList-BW5pRFe4.js +0 -65
- package/dist-vue/_chunks/PkToolShowProductList-BW5pRFe4.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowVideo-BZOTu2Qe.js +0 -122
- package/dist-vue/_chunks/PkToolShowVideo-BZOTu2Qe.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowWebPages-BiIBRV_n.js +0 -79
- package/dist-vue/_chunks/PkToolShowWebPages-BiIBRV_n.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import "./src-DT8FLE4_.js";
|
|
3
|
-
import { n as t } from "./url-validation-9DstIfq2.js";
|
|
4
|
-
import { t as n } from "./useImageFallback-5vQIO0pC.js";
|
|
5
|
-
import { n as r, r as i } from "./PkChatbotFilePreview-CwiVQDF2.js";
|
|
6
|
-
import { VvIcon as a } from "@volverjs/ui-vue/components";
|
|
7
|
-
import { Fragment as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, normalizeClass as p, onMounted as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, unref as y } from "vue";
|
|
8
|
-
//#region ../../packages/components/src/chat/PkToolShowImageGallery.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var b = {
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-surface"
|
|
12
|
-
}, x = { class: "px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40" }, S = { class: "font-bold" }, C = { class: "p-sm" }, w = [
|
|
13
|
-
"href",
|
|
14
|
-
"data-pswp-src",
|
|
15
|
-
"data-pswp-width",
|
|
16
|
-
"data-pswp-height",
|
|
17
|
-
"data-pswp-caption",
|
|
18
|
-
"title",
|
|
19
|
-
"target",
|
|
20
|
-
"rel"
|
|
21
|
-
], T = [
|
|
22
|
-
"src",
|
|
23
|
-
"alt",
|
|
24
|
-
"onError"
|
|
25
|
-
], E = {
|
|
26
|
-
key: 1,
|
|
27
|
-
class: "w-full h-full flex flex-col items-center justify-center gap-4 bg-surface-1 text-word-3"
|
|
28
|
-
}, D = { class: "text-12" }, O = /*@__PURE__*/ f({
|
|
29
|
-
__name: "PkToolShowImageGallery",
|
|
30
|
-
props: { part: {} },
|
|
31
|
-
setup(e) {
|
|
32
|
-
let f = e, O = s(() => f.part), k = g(), { preload: A, getSize: j } = r(), M = s(() => O.value.input?.images ?? []), { canShowImage: N, onImageError: P } = n(), F = s(() => {
|
|
33
|
-
let e = M.value.length;
|
|
34
|
-
return e === 1 ? "grid-cols-1 justify-items-center" : e === 2 ? "grid-cols-2" : "grid-cols-3";
|
|
35
|
-
}), { init: I } = i({ gallery: k });
|
|
36
|
-
return m(async () => {
|
|
37
|
-
A(M.value), await I();
|
|
38
|
-
}), (e, n) => {
|
|
39
|
-
let r = a;
|
|
40
|
-
return M.value.length ? (h(), l("div", b, [u("div", x, [d(r, {
|
|
41
|
-
name: "ri:image-line",
|
|
42
|
-
class: "text-16"
|
|
43
|
-
}), u("strong", S, v(e.$t("label.gallery", { count: M.value.length })), 1)]), u("div", C, [u("div", {
|
|
44
|
-
ref_key: "galleryRef",
|
|
45
|
-
ref: k,
|
|
46
|
-
class: p(["grid gap-8", F.value])
|
|
47
|
-
}, [(h(!0), l(o, null, _(M.value, (n) => (h(), l("a", {
|
|
48
|
-
key: n.url,
|
|
49
|
-
href: y(N)(n.url) ? n.url : void 0,
|
|
50
|
-
"data-pswp-src": y(N)(n.url) ? n.url : void 0,
|
|
51
|
-
"data-pswp-width": y(j)(n.url).width,
|
|
52
|
-
"data-pswp-height": y(j)(n.url).height,
|
|
53
|
-
"data-pswp-caption": n.caption ?? n.alt ?? "",
|
|
54
|
-
"data-cropped": !0,
|
|
55
|
-
class: p(["relative block aspect-square overflow-hidden rounded-xl group max-h-384", [{ "w-384 max-w-full": M.value.length === 1 }, y(N)(n.url) ? "cursor-pointer" : "pointer-events-none"]]),
|
|
56
|
-
title: n.caption ?? n.alt ?? "",
|
|
57
|
-
target: y(t)(n.url) ? void 0 : "_blank",
|
|
58
|
-
rel: y(t)(n.url) ? void 0 : "noopener noreferrer"
|
|
59
|
-
}, [y(N)(n.url) ? (h(), l("img", {
|
|
60
|
-
key: 0,
|
|
61
|
-
src: n.url,
|
|
62
|
-
alt: n.alt ?? n.caption ?? "",
|
|
63
|
-
class: "w-full h-full object-cover transition-opacity group-hover:opacity-80",
|
|
64
|
-
onError: (e) => y(P)(n.url)
|
|
65
|
-
}, null, 40, T)) : (h(), l("div", E, [d(r, {
|
|
66
|
-
name: "ri:camera-off-line",
|
|
67
|
-
class: "text-24"
|
|
68
|
-
}), u("span", D, v(e.$t("label.imageLoadError")), 1)]))], 10, w))), 128))], 2)])])) : c("", !0);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}), k = /* @__PURE__ */ e({ default: () => A }), A = O;
|
|
72
|
-
//#endregion
|
|
73
|
-
export { k as n, A as t };
|
|
74
|
-
|
|
75
|
-
//# sourceMappingURL=PkToolShowImageGallery-DmhZLnBk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowImageGallery-DmhZLnBk.js","names":["$t","__unplugin_components_0","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_normalizeClass","_Fragment","_renderList","_unref","_createCommentVNode","_sfc_main","__exportAll","isSameSite","useImageFallback","useImageSizes","useLightbox","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","PkToolShowImageGallery_vue_vue_type_script_setup_true_lang_default","props","__props","toolPart","computed","galleryRef","ref","images","gridCols","count","onMounted","preload","init","_component_VvIcon","VvIcon","openBlock","createElementBlock","createElementVNode","createVNode","toDisplayString","_ctx","normalizeClass","Fragment","renderList","image","unref","canShowImage","getSize","onImageError","createCommentVNode","PkToolShowImageGallery_exports","PkToolShowImageGallery_default"],"sources":["../../../../packages/components/src/chat/PkToolShowImageGallery.vue","../../../../packages/components/src/chat/PkToolShowImageGallery.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, onMounted } from 'vue'\n import { isSameSite } from 'utils'\n import { useImageFallback } from 'composables'\n import { useLightbox, useImageSizes } from '../composables/useLightbox'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n images: Array<{\n url: string\n caption?: string\n alt?: string\n }>\n }\n }\n return part\n })\n\n const galleryRef = ref<HTMLElement>()\n const { preload, getSize } = useImageSizes()\n\n const images = computed(() => toolPart.value.input?.images ?? [])\n\n const { canShowImage, onImageError } = useImageFallback()\n\n const gridCols = computed(() => {\n const count = images.value.length\n if (count === 1) {\n return 'grid-cols-1 justify-items-center'\n }\n if (count === 2) {\n return 'grid-cols-2'\n }\n return 'grid-cols-3'\n })\n\n const { init } = useLightbox({ gallery: galleryRef })\n\n onMounted(async () => {\n preload(images.value)\n await init()\n })\n</script>\n\n<template>\n <div\n v-if=\"images.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:image-line\" class=\"text-16\" />\n <strong class=\"font-bold\">\n {{ $t('label.gallery', { count: images.length }) }}\n </strong>\n </div>\n <div class=\"p-sm\">\n <div ref=\"galleryRef\" class=\"grid gap-8\" :class=\"gridCols\">\n <a\n v-for=\"image in images\"\n :key=\"image.url\"\n :href=\"canShowImage(image.url) ? image.url : undefined\"\n :data-pswp-src=\"\n canShowImage(image.url) ? image.url : undefined\n \"\n :data-pswp-width=\"getSize(image.url).width\"\n :data-pswp-height=\"getSize(image.url).height\"\n :data-pswp-caption=\"image.caption ?? image.alt ?? ''\"\n :data-cropped=\"true\"\n class=\"relative block aspect-square overflow-hidden rounded-xl group max-h-384\"\n :class=\"[\n { 'w-384 max-w-full': images.length === 1 },\n canShowImage(image.url)\n ? 'cursor-pointer'\n : 'pointer-events-none',\n ]\"\n :title=\"image.caption ?? image.alt ?? ''\"\n :target=\"isSameSite(image.url) ? undefined : '_blank'\"\n :rel=\"\n isSameSite(image.url)\n ? undefined\n : 'noopener noreferrer'\n \">\n <img\n v-if=\"canShowImage(image.url)\"\n :src=\"image.url\"\n :alt=\"image.alt ?? image.caption ?? ''\"\n class=\"w-full h-full object-cover transition-opacity group-hover:opacity-80\"\n @error=\"onImageError(image.url)\" />\n <div\n v-else\n class=\"w-full h-full flex flex-col items-center justify-center gap-4 bg-surface-1 text-word-3\">\n <VvIcon name=\"ri:camera-off-line\" class=\"text-24\" />\n <span class=\"text-12\">{{\n $t('label.imageLoadError')\n }}</span>\n </div>\n </a>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, onMounted } from 'vue'\n import { isSameSite } from 'utils'\n import { useImageFallback } from 'composables'\n import { useLightbox, useImageSizes } from '../composables/useLightbox'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n images: Array<{\n url: string\n caption?: string\n alt?: string\n }>\n }\n }\n return part\n })\n\n const galleryRef = ref<HTMLElement>()\n const { preload, getSize } = useImageSizes()\n\n const images = computed(() => toolPart.value.input?.images ?? [])\n\n const { canShowImage, onImageError } = useImageFallback()\n\n const gridCols = computed(() => {\n const count = images.value.length\n if (count === 1) {\n return 'grid-cols-1 justify-items-center'\n }\n if (count === 2) {\n return 'grid-cols-2'\n }\n return 'grid-cols-3'\n })\n\n const { init } = useLightbox({ gallery: galleryRef })\n\n onMounted(async () => {\n preload(images.value)\n await init()\n })\n</script>\n\n<template>\n <div\n v-if=\"images.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:image-line\" class=\"text-16\" />\n <strong class=\"font-bold\">\n {{ $t('label.gallery', { count: images.length }) }}\n </strong>\n </div>\n <div class=\"p-sm\">\n <div ref=\"galleryRef\" class=\"grid gap-8\" :class=\"gridCols\">\n <a\n v-for=\"image in images\"\n :key=\"image.url\"\n :href=\"canShowImage(image.url) ? image.url : undefined\"\n :data-pswp-src=\"\n canShowImage(image.url) ? image.url : undefined\n \"\n :data-pswp-width=\"getSize(image.url).width\"\n :data-pswp-height=\"getSize(image.url).height\"\n :data-pswp-caption=\"image.caption ?? image.alt ?? ''\"\n :data-cropped=\"true\"\n class=\"relative block aspect-square overflow-hidden rounded-xl group max-h-384\"\n :class=\"[\n { 'w-384 max-w-full': images.length === 1 },\n canShowImage(image.url)\n ? 'cursor-pointer'\n : 'pointer-events-none',\n ]\"\n :title=\"image.caption ?? image.alt ?? ''\"\n :target=\"isSameSite(image.url) ? undefined : '_blank'\"\n :rel=\"\n isSameSite(image.url)\n ? undefined\n : 'noopener noreferrer'\n \">\n <img\n v-if=\"canShowImage(image.url)\"\n :src=\"image.url\"\n :alt=\"image.alt ?? image.caption ?? ''\"\n class=\"w-full h-full object-cover transition-opacity group-hover:opacity-80\"\n @error=\"onImageError(image.url)\" />\n <div\n v-else\n class=\"w-full h-full flex flex-col items-center justify-center gap-4 bg-surface-1 text-word-3\">\n <VvIcon name=\"ri:camera-off-line\" class=\"text-24\" />\n <span class=\"text-12\">{{\n $t('label.imageLoadError')\n }}</span>\n </div>\n </a>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMI,IAAM2B,IAAQC,GAIRC,IAAWC,QACAH,EAAM,IAUtB,GAEKI,IAAaC,EAAiB,GAC9B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AE;IACrC,qBAAmBA,EAAM,WAAWA,EAAM,OAAG;IAC7C,gBAAc;IACf,OAAK3C,EAAA,CAAC,2EAAyE,CACvB,EAAA,oBAAA0B,EAAA,MAAO,WAAM,EAAA,GAAkCvB,EAAA0C,CAAA,CAAY,CAACF,EAAM,GAAG,IAAA,mBAAA,qBAAA,CAAA,CAAA;IAM5H,OAAOA,EAAM,WAAWA,EAAM,OAAG;IACjC,QAAQxC,EAAAI,CAAA,CAAU,CAACoC,EAAM,GAAG,IAAI,KAAA,IAAS;IACzC,KAA8BxC,EAAAI,CAAA,CAAU,CAACoC,EAAM,GAAG,IAAgC,KAAA,IAAA;GAMzExC,GAAAA,CAAAA,EAAA0C,CAAA,CAAY,CAACF,EAAM,GAAG,KADhChD,EAAA,GAAAC,EAKuC,OAAA;;IAHlC,KAAK+C,EAAM;IACX,KAAKA,EAAM,OAAOA,EAAM,WAAO;IAChC,OAAM;IACL,UAAK,MAAExC,EAAA4C,CAAA,CAAY,CAACJ,EAAM,GAAG;GAClChD,GAAAA,MAAAA,IAAAA,CAAAA,MAAAA,EAAA,GAAAC,EAOM,OAPNqB,GAOM,CAJFnB,EAAoDkC,GAAA;IAA5C,MAAK;IAAqB,OAAM;GACxCnC,CAAAA,GAAAA,EAES,QAFTqB,GAESnB,EADLN,EAAAA,GAAE,sBAAA,CAAA,GAAA,CAAA,CAAA,CAAA,EAAA,GAAA,IAAAsB,CAAA"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "./PkLazyImg-CDxX9xnq.js";
|
|
3
|
-
import { t as n } from "./PkUrl-E12f7rn_.js";
|
|
4
|
-
import { VvIcon as r } from "@volverjs/ui-vue/components";
|
|
5
|
-
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, openBlock as f, renderList as p, resolveDynamicComponent as m, toDisplayString as h, withCtx as g } from "vue";
|
|
6
|
-
//#region ../../packages/components/src/chat/PkToolShowProductList.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var _ = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "u-pick-list w-full"
|
|
10
|
-
}, v = { class: "flex flex-col gap-4 min-w-0 flex-1" }, y = { class: "font-bold text-12 text-word-1 truncate" }, b = {
|
|
11
|
-
key: 0,
|
|
12
|
-
class: "text-10 text-word-4 truncate flex items-center gap-4"
|
|
13
|
-
}, x = { class: "flex items-center gap-sm flex-wrap text-12" }, S = {
|
|
14
|
-
key: 0,
|
|
15
|
-
class: "font-semibold text-word-1"
|
|
16
|
-
}, C = {
|
|
17
|
-
key: 1,
|
|
18
|
-
class: "text-10 text-word-3"
|
|
19
|
-
}, w = {
|
|
20
|
-
key: 1,
|
|
21
|
-
class: "text-12 text-word-3 line-clamp-2"
|
|
22
|
-
}, T = /*@__PURE__*/ d({
|
|
23
|
-
__name: "PkToolShowProductList",
|
|
24
|
-
props: { part: {} },
|
|
25
|
-
setup(e) {
|
|
26
|
-
let d = e, T = a(() => d.part);
|
|
27
|
-
return (e, a) => {
|
|
28
|
-
let d = r;
|
|
29
|
-
return T.value?.input?.products?.length ? (f(), c("ul", _, [(f(!0), c(i, null, p(T.value.input.products, (e, r) => (f(), c("li", {
|
|
30
|
-
key: r,
|
|
31
|
-
class: "u-pick-list__row"
|
|
32
|
-
}, [(f(), o(m(e.url ? "a" : "div"), {
|
|
33
|
-
href: e.url,
|
|
34
|
-
target: e.url ? "_blank" : void 0,
|
|
35
|
-
rel: e.url ? "noopener noreferrer" : void 0,
|
|
36
|
-
class: "u-pick-list__entry"
|
|
37
|
-
}, {
|
|
38
|
-
default: g(() => [e.image ? (f(), o(t, {
|
|
39
|
-
key: 0,
|
|
40
|
-
src: e.image,
|
|
41
|
-
alt: e.name,
|
|
42
|
-
"fallback-icon": "ri:image-off-line",
|
|
43
|
-
class: "w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface"
|
|
44
|
-
}, null, 8, ["src", "alt"])) : s("", !0), l("div", v, [
|
|
45
|
-
l("strong", y, h(e.name), 1),
|
|
46
|
-
e.url ? (f(), c("span", b, [u(d, {
|
|
47
|
-
name: "ri:link",
|
|
48
|
-
class: "shrink-0 text-12"
|
|
49
|
-
}), u(n, { url: e.url }, null, 8, ["url"])])) : s("", !0),
|
|
50
|
-
l("div", x, [e.price ? (f(), c("span", S, h(e.price), 1)) : s("", !0), e.availability ? (f(), c("span", C, h(e.availability), 1)) : s("", !0)]),
|
|
51
|
-
e.description ? (f(), c("p", w, h(e.description), 1)) : s("", !0)
|
|
52
|
-
])]),
|
|
53
|
-
_: 2
|
|
54
|
-
}, 1032, [
|
|
55
|
-
"href",
|
|
56
|
-
"target",
|
|
57
|
-
"rel"
|
|
58
|
-
]))]))), 128))])) : s("", !0);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}), E = /* @__PURE__ */ e({ default: () => D }), D = T;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { E as n, D as t };
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=PkToolShowProductList-BW5pRFe4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowProductList-BW5pRFe4.js","names":["__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_renderList","_createBlock","_resolveDynamicComponent","_withCtx","PkLazyImg","_createCommentVNode","_createElementVNode","_toDisplayString","_createVNode","PkUrl","_sfc_main","__exportAll","PkUrl_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","PkToolShowProductList_vue_vue_type_script_setup_true_lang_default","props","__props","toolPart","computed","_component_VvIcon","VvIcon","openBlock","createElementBlock","Fragment","renderList","index","createBlock","resolveDynamicComponent","product","withCtx","PkLazyImg_default","createCommentVNode","createElementVNode","toDisplayString","createVNode","PkToolShowProductList_exports","PkToolShowProductList_default"],"sources":["../../../../packages/components/src/chat/PkToolShowProductList.vue","../../../../packages/components/src/chat/PkToolShowProductList.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue'\n import PkLazyImg from '../PkLazyImg.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n products: Array<{\n name: string\n url?: string\n image?: string\n price?: string\n availability?: string\n description?: string\n }>\n }\n }\n return part\n })\n</script>\n\n<template>\n <ul v-if=\"toolPart?.input?.products?.length\" class=\"u-pick-list w-full\">\n <li\n v-for=\"(product, index) in toolPart.input.products\"\n :key=\"index\"\n class=\"u-pick-list__row\">\n <component\n :is=\"product.url ? 'a' : 'div'\"\n :href=\"product.url\"\n :target=\"product.url ? '_blank' : undefined\"\n :rel=\"product.url ? 'noopener noreferrer' : undefined\"\n class=\"u-pick-list__entry\">\n <!-- Merchant images rot over time: a dead one degrades to an icon\n so the row keeps its thumbnail slot -->\n <PkLazyImg\n v-if=\"product.image\"\n :src=\"product.image\"\n :alt=\"product.name\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong class=\"font-bold text-12 text-word-1 truncate\">\n {{ product.name }}\n </strong>\n <span\n v-if=\"product.url\"\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"product.url\" />\n </span>\n <div class=\"flex items-center gap-sm flex-wrap text-12\">\n <span\n v-if=\"product.price\"\n class=\"font-semibold text-word-1\">\n {{ product.price }}\n </span>\n <!-- Free text from the merchant: it was colour-coded by\n substring, which only ever matched English and\n Italian. It reads as the note it is. -->\n <span\n v-if=\"product.availability\"\n class=\"text-10 text-word-3\">\n {{ product.availability }}\n </span>\n </div>\n <p\n v-if=\"product.description\"\n class=\"text-12 text-word-3 line-clamp-2\">\n {{ product.description }}\n </p>\n </div>\n </component>\n </li>\n </ul>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import PkLazyImg from '../PkLazyImg.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n products: Array<{\n name: string\n url?: string\n image?: string\n price?: string\n availability?: string\n description?: string\n }>\n }\n }\n return part\n })\n</script>\n\n<template>\n <ul v-if=\"toolPart?.input?.products?.length\" class=\"u-pick-list w-full\">\n <li\n v-for=\"(product, index) in toolPart.input.products\"\n :key=\"index\"\n class=\"u-pick-list__row\">\n <component\n :is=\"product.url ? 'a' : 'div'\"\n :href=\"product.url\"\n :target=\"product.url ? '_blank' : undefined\"\n :rel=\"product.url ? 'noopener noreferrer' : undefined\"\n class=\"u-pick-list__entry\">\n <!-- Merchant images rot over time: a dead one degrades to an icon\n so the row keeps its thumbnail slot -->\n <PkLazyImg\n v-if=\"product.image\"\n :src=\"product.image\"\n :alt=\"product.name\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong class=\"font-bold text-12 text-word-1 truncate\">\n {{ product.name }}\n </strong>\n <span\n v-if=\"product.url\"\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"product.url\" />\n </span>\n <div class=\"flex items-center gap-sm flex-wrap text-12\">\n <span\n v-if=\"product.price\"\n class=\"font-semibold text-word-1\">\n {{ product.price }}\n </span>\n <!-- Free text from the merchant: it was colour-coded by\n substring, which only ever matched English and\n Italian. It reads as the note it is. -->\n <span\n v-if=\"product.availability\"\n class=\"text-10 text-word-3\">\n {{ product.availability }}\n </span>\n </div>\n <p\n v-if=\"product.description\"\n class=\"text-12 text-word-3 line-clamp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ADA4B,EAAQ,KAAK,GAAA,CAAA,KAAAG,EAAA,IAAA,EAAA,GAMVH,EAAQ,gBADlBtC,EAAA,GAAAC,EAIO,QAJPqB,GAIOZ,EADA4B,EAAQ,YAAY,GAAA,CAAA,KAAAG,EAAA,IAAA,EAAA,CAAA,CAAA;KAIrBH,EAAQ,eADlBtC,EAAA,GAAAC,EAII,KAJJsB,GAIIb,EADG4B,EAAQ,WAAW,GAAA,CAAA,KAAAG,EAAA,IAAA,EAAA"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import "./src-DT8FLE4_.js";
|
|
2
|
-
import { VvIcon as e } from "@volverjs/ui-vue/components";
|
|
3
|
-
import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, openBlock as c, renderList as l, toDisplayString as u } from "vue";
|
|
4
|
-
//#region ../../packages/utils/src/video-source.ts
|
|
5
|
-
var d = (e) => e.replace(/[^a-zA-Z0-9_-]/g, ""), f = (e, t) => e === t || e.endsWith(`.${t}`), p = (e) => {
|
|
6
|
-
if (e.hostname.endsWith("youtu.be")) return d(e.pathname.split("/")[1] ?? "") || null;
|
|
7
|
-
let t = e.searchParams.get("v");
|
|
8
|
-
if (t) return d(t) || null;
|
|
9
|
-
let n = e.pathname.match(/^\/(?:shorts|live|embed|v)\/([^/?#]+)/);
|
|
10
|
-
return n && d(n[1]) || null;
|
|
11
|
-
}, m = (e) => {
|
|
12
|
-
let t = e.pathname.match(/(?:^|\/)(\d+)(?:$|[/?#])/);
|
|
13
|
-
return t ? t[1] : null;
|
|
14
|
-
};
|
|
15
|
-
function h(e, t) {
|
|
16
|
-
let n;
|
|
17
|
-
try {
|
|
18
|
-
n = new URL(e);
|
|
19
|
-
} catch {
|
|
20
|
-
return {
|
|
21
|
-
provider: "file",
|
|
22
|
-
url: e,
|
|
23
|
-
embedUrl: e
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
let r = n.hostname.toLowerCase();
|
|
27
|
-
if (f(r, "youtube.com") || f(r, "youtu.be") || f(r, "youtube-nocookie.com")) {
|
|
28
|
-
let t = p(n);
|
|
29
|
-
if (t) return {
|
|
30
|
-
provider: "youtube",
|
|
31
|
-
url: e,
|
|
32
|
-
videoId: t,
|
|
33
|
-
embedUrl: `https://www.youtube-nocookie.com/embed/${t}`,
|
|
34
|
-
thumbnailUrl: `https://img.youtube.com/vi/${t}/hqdefault.jpg`
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
if (f(r, "vimeo.com")) {
|
|
38
|
-
let t = m(n);
|
|
39
|
-
if (t) return {
|
|
40
|
-
provider: "vimeo",
|
|
41
|
-
url: e,
|
|
42
|
-
videoId: t,
|
|
43
|
-
embedUrl: `https://player.vimeo.com/video/${t}?dnt=1`
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return t && t !== "file" ? {
|
|
47
|
-
provider: t,
|
|
48
|
-
url: e,
|
|
49
|
-
embedUrl: e
|
|
50
|
-
} : {
|
|
51
|
-
provider: "file",
|
|
52
|
-
url: e,
|
|
53
|
-
embedUrl: e
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region ../../packages/components/src/chat/PkToolShowVideo.vue?vue&type=script&setup=true&lang.ts
|
|
58
|
-
var g = {
|
|
59
|
-
key: 0,
|
|
60
|
-
class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-surface"
|
|
61
|
-
}, _ = { class: "px-sm py-6 bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40" }, v = { class: "font-bold" }, y = { class: "p-sm flex flex-col gap-16" }, b = {
|
|
62
|
-
key: 0,
|
|
63
|
-
class: "font-bold text-14 mb-sm"
|
|
64
|
-
}, x = ["src", "poster"], S = ["href"], C = {
|
|
65
|
-
key: 2,
|
|
66
|
-
class: "relative w-full overflow-hidden rounded-xl bg-word-1",
|
|
67
|
-
style: { "aspect-ratio": "16 / 9" }
|
|
68
|
-
}, w = ["src", "title"], T = {
|
|
69
|
-
key: 3,
|
|
70
|
-
class: "text-12 text-word-3 mt-sm"
|
|
71
|
-
}, E = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share", D = /* @__PURE__ */ s({
|
|
72
|
-
__name: "PkToolShowVideo",
|
|
73
|
-
props: { part: {} },
|
|
74
|
-
setup(s) {
|
|
75
|
-
let d = s, f = n(() => (d.part.input?.videos ?? []).map((e) => ({
|
|
76
|
-
...e,
|
|
77
|
-
source: h(e.url, e.provider)
|
|
78
|
-
})));
|
|
79
|
-
return (n, s) => {
|
|
80
|
-
let d = e;
|
|
81
|
-
return f.value.length ? (c(), i("div", g, [a("div", _, [o(d, {
|
|
82
|
-
name: "ri:film-line",
|
|
83
|
-
class: "text-16"
|
|
84
|
-
}), a("strong", v, u(n.$t("label.video")), 1)]), a("div", y, [(c(!0), i(t, null, l(f.value, (e) => (c(), i("div", {
|
|
85
|
-
key: e.url,
|
|
86
|
-
class: "flex flex-col"
|
|
87
|
-
}, [
|
|
88
|
-
e.title ? (c(), i("strong", b, u(e.title), 1)) : r("", !0),
|
|
89
|
-
e.source.provider === "file" ? (c(), i("video", {
|
|
90
|
-
key: 1,
|
|
91
|
-
src: e.source.embedUrl,
|
|
92
|
-
poster: e.poster,
|
|
93
|
-
controls: "",
|
|
94
|
-
preload: "metadata",
|
|
95
|
-
playsinline: "",
|
|
96
|
-
class: "w-full rounded-xl bg-word-1",
|
|
97
|
-
style: {
|
|
98
|
-
"aspect-ratio": "16 / 9",
|
|
99
|
-
"max-height": "480px"
|
|
100
|
-
}
|
|
101
|
-
}, [a("a", {
|
|
102
|
-
href: e.url,
|
|
103
|
-
target: "_blank",
|
|
104
|
-
rel: "noopener noreferrer"
|
|
105
|
-
}, u(e.title ?? e.url), 9, S)], 8, x)) : (c(), i("div", C, [a("iframe", {
|
|
106
|
-
src: e.source.embedUrl,
|
|
107
|
-
title: e.title ?? e.url,
|
|
108
|
-
loading: "lazy",
|
|
109
|
-
referrerpolicy: "strict-origin-when-cross-origin",
|
|
110
|
-
allow: E,
|
|
111
|
-
allowfullscreen: "",
|
|
112
|
-
class: "absolute inset-0 w-full h-full border-0"
|
|
113
|
-
}, null, 8, w)])),
|
|
114
|
-
e.description ? (c(), i("span", T, u(e.description), 1)) : r("", !0)
|
|
115
|
-
]))), 128))])])) : r("", !0);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
//#endregion
|
|
120
|
-
export { D as default };
|
|
121
|
-
|
|
122
|
-
//# sourceMappingURL=PkToolShowVideo-BZOTu2Qe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowVideo-BZOTu2Qe.js","names":["$t","__unplugin_components_0","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_Fragment","_renderList","_createCommentVNode","_sfc_main","sanitizeId","raw","hostMatches","host","domain","youtubeId","u","v","m","vimeoId","parseVideoSource","url","id","hint","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","IFRAME_ALLOW","PkToolShowVideo_default","defineComponent","props","__props","videos","computed","video","_component_VvIcon","VvIcon","openBlock","createElementBlock","createElementVNode","createVNode","toDisplayString","_ctx","Fragment","renderList","createCommentVNode"],"sources":["../../../../packages/utils/src/video-source.ts","../../../../packages/components/src/chat/PkToolShowVideo.vue","../../../../packages/components/src/chat/PkToolShowVideo.vue"],"sourcesContent":["/**\n * Video source parsing shared by the backend platform renderer and the frontend\n * player component, so both classify a video URL the same way.\n *\n * A URL is either a known provider (YouTube/Vimeo), which plays through the\n * provider's iframe embed, or a direct media file (`file`), which plays in a\n * native `<video>` element. Detection is by URL shape; an explicit `hint` is\n * used only as a fallback when the URL alone is inconclusive.\n */\n\nexport type VideoProvider = 'youtube' | 'vimeo' | 'file'\n\nexport interface ParsedVideoSource {\n provider: VideoProvider\n /** The original URL, unchanged. */\n url: string\n /**\n * The URL to actually load: the provider iframe embed URL for\n * YouTube/Vimeo, or the direct file URL for `file`.\n */\n embedUrl: string\n /** The provider video id (providers only). */\n videoId?: string\n /**\n * A preview image URL derived from the provider, when one is available\n * without an extra API call (currently YouTube only). Lets a link-only\n * surface (e.g. a Teams card) show a thumbnail instead of a bare link.\n */\n thumbnailUrl?: string\n}\n\n/** Keep only characters that are legal in a provider video id. */\nconst sanitizeId = (raw: string): string => raw.replace(/[^a-zA-Z0-9_-]/g, '')\n\n/**\n * True when `host` is exactly `domain` or a subdomain of it. Guards against\n * lookalike hosts (e.g. `notyoutube.com`) that a bare substring check would\n * misclassify.\n */\nconst hostMatches = (host: string, domain: string): boolean =>\n host === domain || host.endsWith(`.${domain}`)\n\n/** Extract the YouTube video id from any of its URL shapes, or null. */\nconst youtubeId = (u: URL): string | null => {\n // youtu.be/<id>\n if (u.hostname.endsWith('youtu.be')) {\n return sanitizeId(u.pathname.split('/')[1] ?? '') || null\n }\n // youtube.com/watch?v=<id>\n const v = u.searchParams.get('v')\n if (v) {\n return sanitizeId(v) || null\n }\n // youtube.com/shorts/<id>, /live/<id>, /embed/<id>, /v/<id>\n const m = u.pathname.match(/^\\/(?:shorts|live|embed|v)\\/([^/?#]+)/)\n return m ? sanitizeId(m[1]) || null : null\n}\n\n/** Extract the Vimeo (numeric) video id, or null. */\nconst vimeoId = (u: URL): string | null => {\n // player.vimeo.com/video/<id> or vimeo.com/<id>\n const m = u.pathname.match(/(?:^|\\/)(\\d+)(?:$|[/?#])/)\n return m ? m[1] : null\n}\n\n/**\n * Classify a video URL into a provider + a loadable embed/file URL.\n * Falls back to `file` (native `<video>`) for anything not recognized as a\n * supported provider, or when a provider is matched but no id can be extracted.\n */\nexport function parseVideoSource(\n url: string,\n hint?: VideoProvider,\n): ParsedVideoSource {\n let u: URL | undefined\n try {\n u = new URL(url)\n } catch {\n // Not an absolute URL: treat as a direct file reference.\n return { provider: 'file', url, embedUrl: url }\n }\n\n const host = u.hostname.toLowerCase()\n\n const isYouTube =\n hostMatches(host, 'youtube.com') ||\n hostMatches(host, 'youtu.be') ||\n hostMatches(host, 'youtube-nocookie.com')\n if (isYouTube) {\n const id = youtubeId(u)\n if (id) {\n return {\n provider: 'youtube',\n url,\n videoId: id,\n embedUrl: `https://www.youtube-nocookie.com/embed/${id}`,\n thumbnailUrl: `https://img.youtube.com/vi/${id}/hqdefault.jpg`,\n }\n }\n }\n\n if (hostMatches(host, 'vimeo.com')) {\n const id = vimeoId(u)\n if (id) {\n return {\n provider: 'vimeo',\n url,\n videoId: id,\n // `dnt=1`: the player sets no cookies and records no session\n // data, the Vimeo counterpart of youtube-nocookie above.\n embedUrl: `https://player.vimeo.com/video/${id}?dnt=1`,\n }\n }\n }\n\n // Honor an explicit provider hint only if we could not extract an id from a\n // provider URL (so a caller-tagged provider link still routes to an iframe\n // via its original URL rather than a broken native <video>).\n if (hint && hint !== 'file') {\n return { provider: hint, url, embedUrl: url }\n }\n\n return { provider: 'file', url, embedUrl: url }\n}\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { parseVideoSource, type VideoProvider } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n interface VideoInput {\n url: string\n title?: string\n description?: string\n poster?: string\n provider?: VideoProvider\n }\n\n // Permissions granted to provider embeds (YouTube/Vimeo players).\n const IFRAME_ALLOW =\n 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'\n\n const videos = computed(() => {\n const part = props.part as { input?: { videos?: VideoInput[] } }\n return (part.input?.videos ?? []).map((video) => ({\n ...video,\n source: parseVideoSource(video.url, video.provider),\n }))\n })\n</script>\n\n<template>\n <div\n v-if=\"videos.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:film-line\" class=\"text-16\" />\n <strong class=\"font-bold\">\n {{ $t('label.video') }}\n </strong>\n </div>\n <div class=\"p-sm flex flex-col gap-16\">\n <div v-for=\"video in videos\" :key=\"video.url\" class=\"flex flex-col\">\n <strong v-if=\"video.title\" class=\"font-bold text-14 mb-sm\">\n {{ video.title }}\n </strong>\n <!-- Direct file: native player. Handles MP4/WebM/OGG and works\n inside the widget's Shadow DOM without any extra CSS. -->\n <video\n v-if=\"video.source.provider === 'file'\"\n :src=\"video.source.embedUrl\"\n :poster=\"video.poster\"\n controls\n preload=\"metadata\"\n playsinline\n class=\"w-full rounded-xl bg-word-1\"\n style=\"aspect-ratio: 16 / 9; max-height: 480px\">\n <a\n :href=\"video.url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n {{ video.title ?? video.url }}\n </a>\n </video>\n <!-- Provider (YouTube/Vimeo): iframe embed, 16:9 responsive. -->\n <div\n v-else\n class=\"relative w-full overflow-hidden rounded-xl bg-word-1\"\n style=\"aspect-ratio: 16 / 9\">\n <iframe\n :src=\"video.source.embedUrl\"\n :title=\"video.title ?? video.url\"\n loading=\"lazy\"\n referrerpolicy=\"strict-origin-when-cross-origin\"\n :allow=\"IFRAME_ALLOW\"\n allowfullscreen\n class=\"absolute inset-0 w-full h-full border-0\"></iframe>\n </div>\n <span\n v-if=\"video.description\"\n class=\"text-12 text-word-3 mt-sm\">\n {{ video.description }}\n </span>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { parseVideoSource, type VideoProvider } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n interface VideoInput {\n url: string\n title?: string\n description?: string\n poster?: string\n provider?: VideoProvider\n }\n\n // Permissions granted to provider embeds (YouTube/Vimeo players).\n const IFRAME_ALLOW =\n 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'\n\n const videos = computed(() => {\n const part = props.part as { input?: { videos?: VideoInput[] } }\n return (part.input?.videos ?? []).map((video) => ({\n ...video,\n source: parseVideoSource(video.url, video.provider),\n }))\n })\n</script>\n\n<template>\n <div\n v-if=\"videos.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:film-line\" class=\"text-16\" />\n <strong class=\"font-bold\">\n {{ $t('label.video') }}\n </strong>\n </div>\n <div class=\"p-sm flex flex-col gap-16\">\n <div v-for=\"video in videos\" :key=\"video.url\" class=\"flex flex-col\">\n <strong v-if=\"video.title\" class=\"font-bold text-14 mb-sm\">\n {{ video.title }}\n </strong>\n <!-- Direct file: native player. Handles MP4/WebM/OGG and works\n inside the widget's Shadow DOM without any extra CSS. -->\n <video\n v-if=\"video.source.provider === 'file'\"\n :src=\"video.source.embedUrl\"\n :poster=\"video.poster\"\n controls\n preload=\"metadata\"\n playsinline\n class=\"w-full rounded-xl bg-word-1\"\n style=\"aspect-ratio: 16 / 9; max-height: 480px\">\n <a\n :href=\"video.url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n {{ video.title ?? video.url }}\n </a>\n </video>\n <!-- Provider (YouTube/Vimeo): iframe embed, 16:9 responsive. -->\n <div\n v-else\n class=\"relative w-full overflow-hidden rounded-xl bg-word-1\"\n style=\"aspect-ratio: 16 / 9\">\n <iframe\n :src=\"video.source.embedUrl\"\n :title=\"video.title ?? video.url\"\n loading=\"lazy\"\n referrerpolicy=\"strict-origin-when-cross-origin\"\n :allow=\"IFRAME_ALLOW\"\n allowfullscreen\n class=\"absolute inset-0 w-full h-full border-0\"></iframe>\n </div>\n <span\n v-if=\"video.description\"\n class=\"text-12 text-word-3 mt-sm\">\n {{ video.description }}\n </span>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;AAgCA,IAAMW,KAAc,MAAwBC,EAAI,QAAQ,mBAAmB,EAAE,GAOvEC,KAAe,GAAc,MAC/BC,MAASC,KAAUD,EAAK,SAAS,IAAIC,GAAQ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,EAAA,GAAAC,EAIO,QAJP+B,GAIO5B,EADAoC,EAAM,WAAW,GAAA,CAAA,KAAAW,EAAA,IAAA,EAAA"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import "./src-DT8FLE4_.js";
|
|
3
|
-
import { n as t } from "./url-validation-9DstIfq2.js";
|
|
4
|
-
import { t as n } from "./PkLazyImg-CDxX9xnq.js";
|
|
5
|
-
import { t as r } from "./PkUrl-E12f7rn_.js";
|
|
6
|
-
import { VvIcon as i } from "@volverjs/ui-vue/components";
|
|
7
|
-
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v } from "vue";
|
|
8
|
-
//#region ../../packages/components/src/chat/PkToolShowWebPages.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var y = {
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "u-pick-list w-full shrink-0"
|
|
12
|
-
}, b = [
|
|
13
|
-
"href",
|
|
14
|
-
"title",
|
|
15
|
-
"target",
|
|
16
|
-
"rel"
|
|
17
|
-
], x = { class: "flex flex-col gap-4 min-w-0 flex-1" }, S = { class: "u-pick-list__label font-medium text-12 text-word-1" }, C = { class: "text-10 text-word-4 truncate flex items-center gap-4" }, w = {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "text-12 text-word-3 line-clamp-2"
|
|
20
|
-
}, T = {
|
|
21
|
-
key: 0,
|
|
22
|
-
class: "u-pick-list__row"
|
|
23
|
-
}, E = /*@__PURE__*/ p({
|
|
24
|
-
__name: "PkToolShowWebPages",
|
|
25
|
-
props: { part: {} },
|
|
26
|
-
setup(e) {
|
|
27
|
-
let p = e, E = o(() => p.part), D = (e) => {
|
|
28
|
-
try {
|
|
29
|
-
let t = new URL(e);
|
|
30
|
-
return t.hash = "", t.toString().replace(/\/$/, "");
|
|
31
|
-
} catch {
|
|
32
|
-
return e.trim().replace(/\/$/, "");
|
|
33
|
-
}
|
|
34
|
-
}, O = o(() => {
|
|
35
|
-
let e = /* @__PURE__ */ new Set(), t = [];
|
|
36
|
-
for (let n of E.value.input?.pages || []) {
|
|
37
|
-
let r = D(n.url);
|
|
38
|
-
e.has(r) || (e.add(r), t.push(n));
|
|
39
|
-
}
|
|
40
|
-
return t;
|
|
41
|
-
}), k = h(!1), A = o(() => k.value ? O.value : O.value.slice(0, 2)), j = o(() => O.value.length > 2);
|
|
42
|
-
return (e, o) => {
|
|
43
|
-
let p = i;
|
|
44
|
-
return A.value?.length ? (m(), l("ul", y, [(m(!0), l(a, null, g(A.value, (i, a) => (m(), l("li", {
|
|
45
|
-
key: a,
|
|
46
|
-
class: "u-pick-list__row"
|
|
47
|
-
}, [u("a", {
|
|
48
|
-
href: i.url,
|
|
49
|
-
title: e.$t("action.open"),
|
|
50
|
-
target: v(t)(i.url) ? void 0 : "_blank",
|
|
51
|
-
rel: v(t)(i.url) ? void 0 : "noopener noreferrer",
|
|
52
|
-
class: "u-pick-list__entry u-pick-list__entry--roomy u-pick-list__entry--top"
|
|
53
|
-
}, [i.image ? (m(), s(n, {
|
|
54
|
-
key: 0,
|
|
55
|
-
src: i.image,
|
|
56
|
-
alt: i.title,
|
|
57
|
-
"fallback-icon": "ri:image-off-line",
|
|
58
|
-
class: "w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface"
|
|
59
|
-
}, null, 8, ["src", "alt"])) : c("", !0), u("div", x, [
|
|
60
|
-
u("strong", S, _(i.title), 1),
|
|
61
|
-
u("span", C, [f(p, {
|
|
62
|
-
name: "ri:link",
|
|
63
|
-
class: "shrink-0 text-12"
|
|
64
|
-
}), f(r, { url: i.url }, null, 8, ["url"])]),
|
|
65
|
-
i.description ? (m(), l("p", w, _(i.description), 1)) : c("", !0)
|
|
66
|
-
])], 8, b)]))), 128)), j.value ? (m(), l("li", T, [u("button", {
|
|
67
|
-
class: "u-pick-list__entry text-12 text-word-3 justify-center cursor-pointer",
|
|
68
|
-
onClick: o[0] ||= (e) => k.value = !k.value
|
|
69
|
-
}, [f(p, {
|
|
70
|
-
name: k.value ? "ri:arrow-up-s-line" : "ri:arrow-down-s-line",
|
|
71
|
-
class: "text-16"
|
|
72
|
-
}, null, 8, ["name"]), d(" " + _(k.value ? e.$t("action.showLess") : e.$t("action.showMore", { count: O.value.length - 2 })), 1)])])) : c("", !0)])) : c("", !0);
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
}), D = /* @__PURE__ */ e({ default: () => O }), O = E;
|
|
76
|
-
//#endregion
|
|
77
|
-
export { D as n, O as t };
|
|
78
|
-
|
|
79
|
-
//# sourceMappingURL=PkToolShowWebPages-BiIBRV_n.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowWebPages-BiIBRV_n.js","names":["$t","__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_renderList","_createElementVNode","_unref","_createBlock","PkLazyImg","_createCommentVNode","_toDisplayString","_createVNode","PkUrl","_createTextVNode","_sfc_main","__exportAll","isSameSite","PkLazyImg_default","PkUrl_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","PkToolShowWebPages_vue_vue_type_script_setup_true_lang_default","props","__props","toolPart","computed","normalizeUrl","u","url","uniquePages","seen","result","page","key","showMore","ref","pages","hasMore","_component_VvIcon","VvIcon","openBlock","createElementBlock","Fragment","renderList","index","createElementVNode","_ctx","unref","createBlock","createCommentVNode","toDisplayString","createVNode","_cache","createTextVNode","PkToolShowWebPages_exports","PkToolShowWebPages_default"],"sources":["../../../../packages/components/src/chat/PkToolShowWebPages.vue","../../../../packages/components/src/chat/PkToolShowWebPages.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { isSameSite } from 'utils'\n import PkLazyImg from '../PkLazyImg.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n pages: Array<{\n title: string\n url: string\n image?: string\n description?: string\n }>\n }\n }\n return part\n })\n\n // The model often passes the same URL several times (e.g. multiple KB\n // chunks from one page), so collapse duplicates, keeping the first (richest)\n // entry. Normalize by dropping the hash and any trailing slash.\n const normalizeUrl = (url: string) => {\n try {\n const u = new URL(url)\n u.hash = ''\n return u.toString().replace(/\\/$/, '')\n } catch {\n return url.trim().replace(/\\/$/, '')\n }\n }\n const uniquePages = computed(() => {\n const seen = new Set<string>()\n const result: NonNullable<typeof toolPart.value.input>['pages'] = []\n for (const page of toolPart.value.input?.pages || []) {\n const key = normalizeUrl(page.url)\n if (seen.has(key)) {\n continue\n }\n seen.add(key)\n result.push(page)\n }\n return result\n })\n\n const showMore = ref(false)\n const pages = computed(() => {\n if (showMore.value) {\n return uniquePages.value\n }\n return uniquePages.value.slice(0, 2)\n })\n const hasMore = computed(() => uniquePages.value.length > 2)\n</script>\n\n<template>\n <ul v-if=\"pages?.length\" class=\"u-pick-list w-full shrink-0\">\n <li\n v-for=\"(page, index) in pages\"\n :key=\"index\"\n class=\"u-pick-list__row\">\n <a\n :href=\"page.url\"\n :title=\"$t('action.open')\"\n :target=\"isSameSite(page.url) ? undefined : '_blank'\"\n :rel=\"isSameSite(page.url) ? undefined : 'noopener noreferrer'\"\n class=\"u-pick-list__entry u-pick-list__entry--roomy u-pick-list__entry--top\">\n <!-- og:images the model scraped are third-party urls: a dead one\n degrades to an icon instead of breaking the card layout -->\n <PkLazyImg\n v-if=\"page.image\"\n :src=\"page.image\"\n :alt=\"page.title\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong\n class=\"u-pick-list__label font-medium text-12 text-word-1\">\n {{ page.title }}\n </strong>\n <span\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"page.url\" />\n </span>\n <p\n v-if=\"page.description\"\n class=\"text-12 text-word-3 line-clamp-2\">\n {{ page.description }}\n </p>\n </div>\n </a>\n </li>\n <li v-if=\"hasMore\" class=\"u-pick-list__row\">\n <button\n class=\"u-pick-list__entry text-12 text-word-3 justify-center cursor-pointer\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"\n showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: uniquePages.length - 2,\n })\n }}\n </button>\n </li>\n </ul>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { isSameSite } from 'utils'\n import PkLazyImg from '../PkLazyImg.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n pages: Array<{\n title: string\n url: string\n image?: string\n description?: string\n }>\n }\n }\n return part\n })\n\n // The model often passes the same URL several times (e.g. multiple KB\n // chunks from one page), so collapse duplicates, keeping the first (richest)\n // entry. Normalize by dropping the hash and any trailing slash.\n const normalizeUrl = (url: string) => {\n try {\n const u = new URL(url)\n u.hash = ''\n return u.toString().replace(/\\/$/, '')\n } catch {\n return url.trim().replace(/\\/$/, '')\n }\n }\n const uniquePages = computed(() => {\n const seen = new Set<string>()\n const result: NonNullable<typeof toolPart.value.input>['pages'] = []\n for (const page of toolPart.value.input?.pages || []) {\n const key = normalizeUrl(page.url)\n if (seen.has(key)) {\n continue\n }\n seen.add(key)\n result.push(page)\n }\n return result\n })\n\n const showMore = ref(false)\n const pages = computed(() => {\n if (showMore.value) {\n return uniquePages.value\n }\n return uniquePages.value.slice(0, 2)\n })\n const hasMore = computed(() => uniquePages.value.length > 2)\n</script>\n\n<template>\n <ul v-if=\"pages?.length\" class=\"u-pick-list w-full shrink-0\">\n <li\n v-for=\"(page, index) in pages\"\n :key=\"index\"\n class=\"u-pick-list__row\">\n <a\n :href=\"page.url\"\n :title=\"$t('action.open')\"\n :target=\"isSameSite(page.url) ? undefined : '_blank'\"\n :rel=\"isSameSite(page.url) ? undefined : 'noopener noreferrer'\"\n class=\"u-pick-list__entry u-pick-list__entry--roomy u-pick-list__entry--top\">\n <!-- og:images the model scraped are third-party urls: a dead one\n degrades to an icon instead of breaking the card layout -->\n <PkLazyImg\n v-if=\"page.image\"\n :src=\"page.image\"\n :alt=\"page.title\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong\n class=\"u-pick-list__label font-medium text-12 text-word-1\">\n {{ page.title }}\n </strong>\n <span\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"page.url\" />\n </span>\n <p\n v-if=\"page.description\"\n class=\"text-12 text-word-3 line-clamp-2\">\n {{ page.description }}\n </p>\n </div>\n </a>\n </li>\n <li v-if=\"hasMore\" class=\"u-pick-list__row\">\n <button\n class=\"u-pick-list__entry text-12 text-word-3 justify-center cursor-pointer\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"\n showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: uniquePages.length - 2,\n })\n }}\n </button>\n </li>\n </ul>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAMI,IAAM4B,IAAQC,GAIRC,IAAWC,QACAH,EAAM,IAWtB,GAKKI,KAAgB,MAAgB;GAClC,IAAI;IACA,IAAMC,IAAI,IAAI,IAAIC,CAAG;IAErB,OADA,EAAE,OAAO,IACFD,EAA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