import { defineComponent, ref, computed, withAsyncContext, watch, resolveDirective, unref, withCtx, mergeProps, createVNode, openBlock, createBlock, Fragment, renderList, withDirectives, createCommentVNode, useSSRContext } from 'vue'; import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrRenderList, ssrGetDirectiveProps, ssrRenderStyle } from 'vue/server-renderer'; import { u as useRouter$1, a as useConfigStore, b as useUserStore, o as useCartStore, p as usePriceStore, m as useIntersectionObserver, _ as __nuxt_component_0 } from './server.mjs'; import { B as BasicIconOld } from './BasicIconOld-Booq7UXp.mjs'; import numbro from 'numbro'; import { H as Highlights, T as Tabs, _ as __nuxt_component_1, a as _sfc_main$1$1, b as _sfc_main$4 } from './filter-CPczHNln.mjs'; import { U as UserProfilePic } from './UserProfilePic-CSSFM-Xe.mjs'; import { l as loadGray, _ as __nuxt_component_0$1 } from './gray-wOBznZcb.mjs'; import { _ as _sfc_main$5 } from './FullScreenStories-Cwtzgmu3.mjs'; import { u as useMediaStore } from './media-Cj7oyS0P.mjs'; import { u as useUserPostStore } from './userPostsStore-zgAQCVWR.mjs'; import { _ as _sfc_main$3 } from './ProductSearchList-B8ViCyeT.mjs'; import { u as usePrice } from './usePrice-CFcNV1RQ.mjs'; import { u as useAsyncData } from './asyncData-DVPmuEBB.mjs'; import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import 'consola'; import 'fast-xml-parser'; import 'ipx'; import 'pinia'; import '@supabase/supabase-js'; import 'axios'; import 'lodash-es'; 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 '@ant-design/icons-vue'; import 'unhead/utils'; import './index-DN2Eqyc3.mjs'; import 'dom-align'; import './index-CQMiaHEh.mjs'; import './shallowequal-CJsWvZb3.mjs'; import 'lodash-es/uniq.js'; import './index-D4HrLPqa.mjs'; import './FormItemContext-DTpHAXaY.mjs'; import './index-BTlbWWOl.mjs'; import 'lodash-es/isPlainObject.js'; import 'resize-observer-polyfill'; import './useRefs-BHKrVg4I.mjs'; import 'lodash-es/pick.js'; import './useMergedState-BZEfJ8Fl.mjs'; import './media-CiMHc-Ka.mjs'; import 'swiper/vue'; import './empty_user-DSxcM_ac.mjs'; import 'vue-content-loader'; import './BasicInput-CgQV_gT5.mjs'; import './like-D4L8S2C_.mjs'; import './BasicButton-7YIRCRg8.mjs'; import './index-CO_xVqO1.mjs'; import 'throttle-debounce'; import 'swiper/modules'; import './BasicActionSheet-BOh-xDh_.mjs'; import './Checkbox-BqbMrYFp.mjs'; import 'perfect-debounce'; function shortenUrl(url, maxLength = 50) { if (url.length <= maxLength) return url; const start = url.slice(0, Math.floor(maxLength / 2) - 3); const end = url.slice(-Math.floor(maxLength / 2)); return `${start}...${end}`; } const _sfc_main$2 = /* @__PURE__ */ defineComponent({ __name: "Seller", __ssrInlineRender: true, async setup(__props) { let __temp, __restore; const router = useRouter$1(); const selectedStoryId = ref(null); const activeKey = ref("products"); ref(false); const config = useConfigStore(); const user = useUserStore(); const mediaStore = useMediaStore(); useCartStore(); const userPost = useUserPostStore(); const onlinePrices = usePriceStore(); const seller = computed(() => config.sellerConfig?.store); const tala18 = computed(() => onlinePrices?.tala18); const userStory = computed(() => { return mediaStore.users.find((x) => x.id === seller.value?.id); }); const formatNumber = (num) => { if (num < 9999) return num; return numbro(num).format({ average: true, // Converts 11230 -> 11.2K, 1000000 -> 1M mantissa: 1 // Number of decimal places }); }; const videoThumbnails = ref({}); const observer = ref(); useIntersectionObserver(observer, async ([{ isIntersecting }]) => { if (isIntersecting && !userPost.loading && !userPost.endPage) { setTimeout(async () => { const nextPage = userPost.currentPage + 1; const data2 = await userPost.loadPosts(seller.value?.user_id, nextPage); userPost.loadStateNextPage(data2); }, 100); } }); const { data } = ([__temp, __restore] = withAsyncContext(async () => useAsyncData("productMainSeller", async () => { userPost.reset(); return await userPost.loadPosts(seller.value?.user_id, 1); })), __temp = await __temp, __restore(), __temp); watch(data, () => { if (data) { userPost.loadStateNextPage(data.value); } }); return (_ctx, _push, _parent, _attrs) => { const _component_ClientOnly = __nuxt_component_0; const _component_client_only = __nuxt_component_0; const _component_ATabs = Tabs; const _component_ATabPane = __nuxt_component_1; const _directive_lazy = resolveDirective("lazy"); let _temp0; _push(`
${ssrInterpolate(seller.value?.username)}
`); _push(ssrRenderComponent(_component_ClientOnly, null, {}, _parent)); _push(`
`); _push(ssrRenderComponent(UserProfilePic, { src: seller.value?.avatar, class: "sm:!w-12rem sm:!h-12rem sm:hidden", onClick: ($event) => userStory.value?.stories?.length === 0 || !userStory.value?.stories ? "" : selectedStoryId.value = seller.value?.id, "just-show-profile": userStory.value?.stories?.length === 0 || !userStory.value?.stories, seenStory: !userStory.value?.stories?.length || userStory.value?.stories?.every((item) => item.storyviews.find((_item) => _item.user_id === unref(user).user?.id || _item.user_id === "me")), showAdd: unref(config).isSeller }, null, _parent)); _push(ssrRenderComponent(UserProfilePic, { src: seller.value?.avatar, class: "sm:!w-12rem sm:!h-12rem hidden sm:block", width: "", onClick: ($event) => userStory.value?.stories?.length === 0 || !userStory.value?.stories ? "" : selectedStoryId.value = seller.value?.id, "just-show-profile": userStory.value?.stories?.length === 0 || !userStory.value?.stories, seenStory: !userStory.value?.stories?.length || userStory.value?.stories?.every((item) => item.storyviews.find((_item) => _item.user_id === unref(user).user?.id || _item.user_id === "me")), showAdd: unref(config).isSeller }, null, _parent)); _push(`

${ssrInterpolate(seller.value?.username)}

${ssrInterpolate(formatNumber(seller.value?.stats?.total_product ?? 0))}
${ssrInterpolate(unref(config).useString("products"))}
`); if (unref(config).isSeller) { _push(`
${ssrInterpolate(formatNumber(seller.value?.stats?.total_customer ?? 0))}
${ssrInterpolate(unref(config).useString("customers"))}
`); } else { _push(``); } _push(`
${ssrInterpolate(formatNumber(unref(config).isSeller ? seller.value?.stats?.sell_total_order_count ?? 0 : unref(user)?.user?.stats?.buy_total_order_count ?? 0))}
${ssrInterpolate(unref(config).isSeller ? unref(config).useString("orders") : unref(config).useString("yourOrders"))}
`); if (unref(config).APP_HAS_GOLD && tala18.value) { _push(`
${ssrInterpolate( // usePrice((tala18/1000)?? 0,true,'') unref(usePrice)(tala18.value / 10, true, "") )}
${ssrInterpolate(unref(config).useString("toman"))}
${ssrInterpolate(unref(config).useString("goldGramPrice"))}
`); } else { _push(``); } _push(`
`); if (seller.value?.website) { _push(`
${ssrInterpolate(seller.value?.bio)}
`); if (seller.value?.website) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:link-1", class: "text-primary", size: "20" }, null, _parent)); _push(` ${ssrInterpolate(seller.value?.website)}
`); } else { _push(``); } if (unref(config).ENAMAD_URL) { _push(`
اینماد
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:link-1", class: "text-primary", size: "20" }, null, _parent)); _push(` ${ssrInterpolate(unref(shortenUrl)(unref(config).ENAMAD_URL))}
`); } else { _push(``); } _push(ssrRenderComponent(_component_client_only, null, {}, _parent)); _push(`
`); _push(ssrRenderComponent(Highlights, { "current-user": seller.value }, null, _parent)); _push(`
`); _push(ssrRenderComponent(_component_ATabs, { activeKey: activeKey.value, "onUpdate:activeKey": ($event) => activeKey.value = $event, centered: "", class: "instaTab" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(ssrRenderComponent(_component_ATabPane, { class: "!w-full", key: "products" }, { tab: withCtx((_2, _push3, _parent3, _scopeId2) => { if (_push3) { _push3(``); _push3(ssrRenderComponent(_sfc_main$1$1, null, null, _parent3, _scopeId2)); _push3(``); } else { return [ createVNode("span", null, [ createVNode(_sfc_main$1$1) ]) ]; } }), default: withCtx((_2, _push3, _parent3, _scopeId2) => { if (_push3) { _push3(`
`); ssrRenderList(unref(userPost).posts, (post, i) => { _push3(`
`); if (post.files?.length) { _push3(``); if (post.files[0]?.type === "image") { _push3(`${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}`); } else if (post.files[0]?.type === "video") { _push3(`
`); } else { _push3(``); } _push3(``); } else { _push3(``); } _push3(`
`); }); _push3(`
`); } else { return [ createVNode("div", { class: "w-full grid sm:grid-cols-4 grid-cols-3 mt-[1px] gap-2px" }, [ (openBlock(true), createBlock(Fragment, null, renderList(unref(userPost).posts, (post, i) => { return openBlock(), createBlock("div", { key: i, class: "w-full aspect-square relative", onClick: ($event) => unref(router).push({ name: "posts", query: { target: post.id, userId: seller.value?.user_id } }) }, [ post.files?.length ? (openBlock(), createBlock(Fragment, { key: 0 }, [ post.files[0]?.type === "image" ? withDirectives((openBlock(), createBlock("img", { key: 0, class: "w-full h-full object-cover", alt: unref(config).appName.en }, null, 8, ["alt"])), [ [_directive_lazy, { src: unref(config).useDataStorage(post.files[0].url), loading: unref(loadGray), error: unref(loadGray) }] ]) : post.files[0]?.type === "video" ? (openBlock(), createBlock("div", { key: 1, class: "relative w-full h-full" }, [ createVNode("video", { ref_for: true, ref: "videoRefs", src: post.files[0]?.url, class: "hidden" }, null, 8, ["src"]), createVNode("img", { src: videoThumbnails.value[post.files[0]?.url], class: "w-full h-full object-cover", alt: "Video Thumbnail" }, null, 8, ["src"]), createVNode("div", { class: "absolute inset-0 flex items-center justify-center bg-black bg-opacity-30" }, [ (openBlock(), createBlock("svg", { class: "w-12 h-12 text-white", fill: "currentColor", viewBox: "0 0 24 24" }, [ createVNode("path", { d: "M8 5v14l11-7z" }) ])) ]) ])) : createCommentVNode("", true) ], 64)) : createCommentVNode("", true) ], 8, ["onClick"]); }), 128)) ]) ]; } }), _: 1 }, _parent2, _scopeId)); _push2(ssrRenderComponent(_component_ATabPane, { class: "!w-full", key: "search" }, { tab: withCtx((_2, _push3, _parent3, _scopeId2) => { if (_push3) { _push3(``); _push3(ssrRenderComponent(_sfc_main$4, null, null, _parent3, _scopeId2)); _push3(``); } else { return [ createVNode("span", null, [ createVNode(_sfc_main$4) ]) ]; } }), default: withCtx((_2, _push3, _parent3, _scopeId2) => { if (_push3) { _push3(ssrRenderComponent(_sfc_main$3, { class: "!-mt-3" }, null, _parent3, _scopeId2)); } else { return [ createVNode(_sfc_main$3, { class: "!-mt-3" }) ]; } }), _: 1 }, _parent2, _scopeId)); } else { return [ createVNode(_component_ATabPane, { class: "!w-full", key: "products" }, { tab: withCtx(() => [ createVNode("span", null, [ createVNode(_sfc_main$1$1) ]) ]), default: withCtx(() => [ createVNode("div", { class: "w-full grid sm:grid-cols-4 grid-cols-3 mt-[1px] gap-2px" }, [ (openBlock(true), createBlock(Fragment, null, renderList(unref(userPost).posts, (post, i) => { return openBlock(), createBlock("div", { key: i, class: "w-full aspect-square relative", onClick: ($event) => unref(router).push({ name: "posts", query: { target: post.id, userId: seller.value?.user_id } }) }, [ post.files?.length ? (openBlock(), createBlock(Fragment, { key: 0 }, [ post.files[0]?.type === "image" ? withDirectives((openBlock(), createBlock("img", { key: 0, class: "w-full h-full object-cover", alt: unref(config).appName.en }, null, 8, ["alt"])), [ [_directive_lazy, { src: unref(config).useDataStorage(post.files[0].url), loading: unref(loadGray), error: unref(loadGray) }] ]) : post.files[0]?.type === "video" ? (openBlock(), createBlock("div", { key: 1, class: "relative w-full h-full" }, [ createVNode("video", { ref_for: true, ref: "videoRefs", src: post.files[0]?.url, class: "hidden" }, null, 8, ["src"]), createVNode("img", { src: videoThumbnails.value[post.files[0]?.url], class: "w-full h-full object-cover", alt: "Video Thumbnail" }, null, 8, ["src"]), createVNode("div", { class: "absolute inset-0 flex items-center justify-center bg-black bg-opacity-30" }, [ (openBlock(), createBlock("svg", { class: "w-12 h-12 text-white", fill: "currentColor", viewBox: "0 0 24 24" }, [ createVNode("path", { d: "M8 5v14l11-7z" }) ])) ]) ])) : createCommentVNode("", true) ], 64)) : createCommentVNode("", true) ], 8, ["onClick"]); }), 128)) ]) ]), _: 1 }), createVNode(_component_ATabPane, { class: "!w-full", key: "search" }, { tab: withCtx(() => [ createVNode("span", null, [ createVNode(_sfc_main$4) ]) ]), default: withCtx(() => [ createVNode(_sfc_main$3, { class: "!-mt-3" }) ]), _: 1 }) ]; } }), _: 1 }, _parent)); _push(`
load
`); if (unref(userPost).loading) { _push(ssrRenderComponent(__nuxt_component_0$1, null, null, _parent)); } else { _push(``); } _push(`
`); if (selectedStoryId.value) { _push(ssrRenderComponent(_sfc_main$5, { id: selectedStoryId.value, "onUpdate:id": ($event) => selectedStoryId.value = $event, specifyId: "" }, null, _parent)); } else { _push(``); } _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/user/userMain/components/Seller.vue"); return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0; }; const Seller = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f04dd4d3"]]); const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "index", __ssrInlineRender: true, setup(__props) { return (_ctx, _push, _parent, _attrs) => { _push(ssrRenderComponent(Seller, _attrs, null, _parent)); }; } }); 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/user/userMain/index.vue"); return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0; }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "index", __ssrInlineRender: true, setup(__props) { return (_ctx, _push, _parent, _attrs) => { _push(ssrRenderComponent(_sfc_main$1, _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/user/index.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default };