import { defineComponent, ref, computed, unref, createVNode, mergeProps, Fragment, watch, nextTick, useSSRContext } from 'vue'; import { ssrRenderComponent, ssrRenderAttrs, ssrRenderClass, ssrInterpolate, ssrRenderAttr, ssrRenderList } from 'vue/server-renderer'; import { s as stdin_default$7, t as truthProp, m as makeStringProp, n as numericProp, a as makeNumericProp, c as createNamespace, w as withInstall, b as addUnit, g as getSizeStyle } from './index-CMTdA55b.mjs'; import { B as BasicIconOld } from './BasicIconOld-I4c2ShMu.mjs'; import { U as UserProfilePic } from './UserProfilePic-DXA233hi.mjs'; import { u as useRouter$1, a as useConfigStore, b as useUserStore, t as reactiveProjectName, a_ as fetchChatMessages } from './server.mjs'; import { _ as _sfc_main$3 } from './BasicTextArea-Cj0DwXpZ.mjs'; import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs'; import './empty_user-BaUNCdgf.mjs'; import '../_/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:url'; import 'consola'; import 'ipx'; import 'node:path'; import 'node:crypto'; import 'pinia'; import '@supabase/supabase-js'; import '@babel/runtime/helpers/esm/extends'; import '@babel/runtime/helpers/esm/objectSpread2'; import '@ant-design/colors'; import '@ctrl/tinycolor'; import 'stylis'; import 'vue-types'; import 'lodash-es'; import 'axios'; import '@ant-design/icons-vue'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'unhead/plugins'; import './index--Q-kfs0Q.mjs'; import './FormItemContext-CDDW52IT.mjs'; import './statusUtils-C3ZNzkeD.mjs'; import './BaseInput-_gwhwanN.mjs'; import 'resize-observer-polyfill'; import './index-C1mihc8c.mjs'; import '../_/SearchOutlined.mjs'; import 'lodash-es/isPlainObject.js'; import './raf-ruCY1ktO.mjs'; const [name$3, bem$3] = createNamespace("skeleton-title"); const skeletonTitleProps = { round: Boolean, titleWidth: numericProp }; var stdin_default$6 = defineComponent({ name: name$3, props: skeletonTitleProps, setup(props) { return () => createVNode("h3", { "class": bem$3([{ round: props.round }]), "style": { width: addUnit(props.titleWidth) } }, null); } }); const SkeletonTitle = withInstall(stdin_default$6); var stdin_default$5 = SkeletonTitle; const [name$2, bem$2] = createNamespace("skeleton-avatar"); const skeletonAvatarProps = { avatarSize: numericProp, avatarShape: makeStringProp("round") }; var stdin_default$4 = defineComponent({ name: name$2, props: skeletonAvatarProps, setup(props) { return () => createVNode("div", { "class": bem$2([props.avatarShape]), "style": getSizeStyle(props.avatarSize) }, null); } }); const SkeletonAvatar = withInstall(stdin_default$4); var stdin_default$3 = SkeletonAvatar; const DEFAULT_ROW_WIDTH = "100%"; const skeletonParagraphProps = { round: Boolean, rowWidth: { type: numericProp, default: DEFAULT_ROW_WIDTH } }; const [name$1, bem$1] = createNamespace("skeleton-paragraph"); var stdin_default$2 = defineComponent({ name: name$1, props: skeletonParagraphProps, setup(props) { return () => createVNode("div", { "class": bem$1([{ round: props.round }]), "style": { width: props.rowWidth } }, null); } }); const SkeletonParagraph = withInstall(stdin_default$2); var stdin_default$1 = SkeletonParagraph; const [name, bem] = createNamespace("skeleton"); const DEFAULT_LAST_ROW_WIDTH = "60%"; const skeletonProps = { row: makeNumericProp(0), round: Boolean, title: Boolean, titleWidth: numericProp, avatar: Boolean, avatarSize: numericProp, avatarShape: makeStringProp("round"), loading: truthProp, animate: truthProp, rowWidth: { type: [Number, String, Array], default: DEFAULT_ROW_WIDTH } }; var stdin_default = defineComponent({ name, inheritAttrs: false, props: skeletonProps, setup(props, { slots, attrs }) { const renderAvatar = () => { if (props.avatar) { return createVNode(stdin_default$3, { "avatarShape": props.avatarShape, "avatarSize": props.avatarSize }, null); } }; const renderTitle = () => { if (props.title) { return createVNode(stdin_default$5, { "round": props.round, "titleWidth": props.titleWidth }, null); } }; const getRowWidth = (index) => { const { rowWidth } = props; if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) { return DEFAULT_LAST_ROW_WIDTH; } if (Array.isArray(rowWidth)) { return rowWidth[index]; } return rowWidth; }; const renderRows = () => Array(+props.row).fill("").map((_, i) => createVNode(stdin_default$1, { "key": i, "round": props.round, "rowWidth": addUnit(getRowWidth(i)) }, null)); const renderContents = () => { if (slots.template) { return slots.template(); } return createVNode(Fragment, null, [renderAvatar(), createVNode("div", { "class": bem("content") }, [renderTitle(), renderRows()])]); }; return () => { var _a; if (!props.loading) { return (_a = slots.default) == null ? void 0 : _a.call(slots); } return createVNode("div", mergeProps({ "class": bem({ animate: props.animate, round: props.round }) }, attrs), [renderContents()]); }; } }); const _imports_0 = "data:image/svg+xml,%3csvg%20width='22'%20height='20'%20viewBox='0%200%2022%2020'%20fill='white'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.0031%201H1.00311L8.50311%208.5M21.0031%201L10.5031%2018.5L8.50311%208.5M21.0031%201L8.50311%208.5'%20stroke='%23733af9'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e"; const _sfc_main$2 = /* @__PURE__ */ defineComponent({ __name: "Conversation", __ssrInlineRender: true, props: { chatId: {} }, setup(__props, { expose: __expose }) { const props = __props; const userStore = useUserStore(); const currentUser = computed(() => userStore.user); const messages = ref([]); const chatContainer = ref(null); const formatTime = (iso) => new Date(iso).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); async function request() { if (!props.chatId) return; const res = await fetchChatMessages(props.chatId, 1, 1e3); messages.value = Array.isArray(res) ? res : res.data || []; } function scrollToBottom() { if (!chatContainer.value) return; nextTick(() => { const el = chatContainer.value; el.scrollTo({ top: el.scrollHeight, behavior: "smooth" }); }); } watch(messages, () => { scrollToBottom(); }); __expose({ request, scrollToBottom }); return (_ctx, _push, _parent, _attrs) => { _push(``); ssrRenderList(messages.value, (message) => { _push(`

${ssrInterpolate(message.text)}

${ssrInterpolate(formatTime(message.created_at))}
`); }); _push(``); }; } }); const _sfc_setup$2 = _sfc_main$2.setup; _sfc_main$2.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/direct/detail/components/Conversation.vue"); return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0; }; const Conversation = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-3b999e95"]]); const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "index", __ssrInlineRender: true, setup(__props) { const router = useRouter$1(); const config = useConfigStore(); const userStore = useUserStore(); const message = ref(""); const conversation = ref(null); const userInfo = ref(void 0); computed(() => { var _a, _b, _c, _d; return ((_b = (_a = config.sellerConfig) == null ? void 0 : _a.store) == null ? void 0 : _b.main) && userStore.user.id !== ((_d = (_c = config.sellerConfig) == null ? void 0 : _c.store) == null ? void 0 : _d.id); }); const loading = ref(false); const addLoading = ref(false); const chatItem = ref(void 0); return (_ctx, _push, _parent, _attrs) => { var _a, _b, _c, _d, _e; const _component_VanSkeleton = stdin_default; const _component_VanLoading = stdin_default$7; _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: unref(config).isRTL ? "vuesax-linear:arrow-right" : "vuesax-linear:arrow-left", onClick: ($event) => unref(router).back() }, null, _parent)); if ((_a = userInfo.value) == null ? void 0 : _a.id) { _push(`
`); _push(ssrRenderComponent(UserProfilePic, { width: "40", src: (_b = userInfo.value) == null ? void 0 : _b.avatar, justShowProfile: "" }, null, _parent)); _push(`
${ssrInterpolate((_c = userInfo.value) == null ? void 0 : _c.name)}
${ssrInterpolate((_d = userInfo.value) == null ? void 0 : _d.username)}
`); } else { _push(``); } _push(`
`); if (loading.value) { _push(ssrRenderComponent(_component_VanSkeleton, null, null, _parent)); } else { _push(ssrRenderComponent(Conversation, { ref_key: "conversation", ref: conversation, chatId: (_e = chatItem.value) == null ? void 0 : _e.chat_id }, null, _parent)); } _push(`
`); _push(ssrRenderComponent(_sfc_main$3, { value: message.value, "onUpdate:value": ($event) => message.value = $event, "place-holder": `${unref(config).useString("message")}...`, class: "!rounded-full border-transparent !bg-transparent message-placeholder !py-3 flex-1", rows: 1 }, null, _parent)); if (message.value === "") { _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:add-circle" }, null, _parent)); } else { _push(`
`); if (!addLoading.value) { _push(``); } else { _push(ssrRenderComponent(_component_VanLoading, { class: "!text-white", type: "spinner", size: "20px" }, null, _parent)); } _push(`
`); } _push(`
`); }; } }); const _sfc_setup$1 = _sfc_main$1.setup; _sfc_main$1.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/direct/detail/index.vue"); return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0; }; const Index = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-61d04548"]]); const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "detail_message", __ssrInlineRender: true, setup(__props) { return (_ctx, _push, _parent, _attrs) => { _push(ssrRenderComponent(Index, _attrs, null, _parent)); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/message/detail_message.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=detail_message-DI-FkHmH.mjs.map