import { defineComponent, ref, computed, withAsyncContext, watch, resolveDirective, unref, withCtx, createVNode, createBlock, openBlock, toDisplayString, createTextVNode, mergeProps, useSSRContext } from 'vue'; import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrRenderList, ssrGetDirectiveProps, ssrRenderStyle } from 'vue/server-renderer'; import { _ as _imports_0, a as _imports_1 } from './cart-DMkYna66.mjs'; import { _ as __nuxt_component_1, a as _sfc_main$6, b as _imports_2, c as _imports_3, d as _sfc_main$5, H as Highlights } from './Highlights-DaFoTGEN.mjs'; import { u as useRouter$1, a as useConfigStore, b as useUserStore, p as useCartStore, n as useIntersectionObserver, q as APP_TYPE, t as reactiveProjectName, o as getToken, x as getSupabaseStorageUrl, c as appName } from './server.mjs'; import { B as BasicIconOld } from './BasicIconOld-I4c2ShMu.mjs'; import numbro from 'numbro'; import { _ as _sfc_main$3 } from './BasicButton-BAlnoE_w.mjs'; import { U as UserProfilePic } from './UserProfilePic-DXA233hi.mjs'; import { l as loadGray, _ as _sfc_main$4 } from './gray-BanKC00A.mjs'; import { _ as _sfc_main$7 } from './FullScreenStories-QnVpPJpC.mjs'; import { u as useMediaStore } from './media-kxpEX2xr.mjs'; import { u as useUserPostStore } from './userPostsStore-CTOjnW_T.mjs'; import { u as useAsyncData } from './asyncData-C9E5x-0d.mjs'; import { B as Badge } from './index-CjBj1lyG.mjs'; import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs'; import '@babel/runtime/helpers/esm/objectSpread2'; import '@babel/runtime/helpers/esm/extends'; import './index-Dxyzjwb5.mjs'; import './raf-ruCY1ktO.mjs'; import 'dom-align'; import './media-BbtM6xvT.mjs'; import 'swiper/vue'; import './empty_user-BaUNCdgf.mjs'; import './post_loading-BiySI7bp.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 './index-DVD7vSfp.mjs'; import '@vueuse/gesture'; import '@headlessui/vue'; import 'framesync'; import 'popmotion'; import 'style-value-types'; import 'lodash-es'; import 'pinia'; import '@supabase/supabase-js'; import '@ant-design/colors'; import '@ctrl/tinycolor'; import 'stylis'; import 'vue-types'; 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-DqCYDGJX.mjs'; import 'throttle-debounce'; import 'vue-content-loader'; import './BasicInput-BEP6ZgUl.mjs'; import './usePrice-B-5-jXKQ.mjs'; 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 './like-BhIOg3YL.mjs'; import 'swiper/modules'; 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 visibleAdd = ref(false); const config = useConfigStore(); const user = useUserStore(); const mediaStore = useMediaStore(); const cartStore = useCartStore(); const userPost = useUserPostStore(); const seller = computed(() => { var _a; return (_a = config.sellerConfig) == null ? void 0 : _a.store; }); const userStory = computed(() => { return mediaStore.users.find((x) => { var _a; return x.id === ((_a = seller.value) == null ? void 0 : _a.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({}); async function shareProfile() { var _a; if ((void 0).share) { try { await (void 0).share({ title: `${config.lang === "fa" ? `${appName.fa}` : `${appName.en}`}`, text: `${(_a = seller.value) == null ? void 0 : _a.bio}`, url: `${(void 0).location.origin}/user` }); } catch (error) { console.error("Sharing failed", error); } } else { alert("Web Share API not supported in this browser."); } } const observer = ref(); useIntersectionObserver(observer, async ([{ isIntersecting }]) => { if (isIntersecting && !userPost.loading && !userPost.endPage) { setTimeout(async () => { var _a; const nextPage = userPost.currentPage + 1; const data2 = await userPost.loadPosts((_a = seller.value) == null ? void 0 : _a.user_id, nextPage); userPost.loadStateNextPage(data2); }, 100); } }); const { data } = ([__temp, __restore] = withAsyncContext(async () => useAsyncData("productMainSeller", async () => { var _a; userPost.reset(); return await userPost.loadPosts((_a = seller.value) == null ? void 0 : _a.user_id, 1); })), __temp = await __temp, __restore(), __temp); watch(data, () => { if (data) { userPost.loadStateNextPage(data.value); } }); return (_ctx, _push, _parent, _attrs) => { var _a2, _b2, _c2, _d2; var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w; const _component_a_badge = Badge; const _component_a_popover = __nuxt_component_1; const _directive_lazy = resolveDirective("lazy"); let _temp0; _push(`
${ssrInterpolate((_a = seller.value) == null ? void 0 : _a.username)}
`); if (!unref(config).isSeller && unref(APP_TYPE) === "single" || unref(APP_TYPE) === "multi") { _push(ssrRenderComponent(_component_a_badge, { count: unref(cartStore).count, dir: "ltr", class: "mt1" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`
`); if (unref(config).isNightStore) { _push2(``); } else { _push2(``); } _push2(`
`); } else { return [ createVNode("div", { onClick: ($event) => unref(router).push({ name: "cart" }) }, [ unref(config).isNightStore ? (openBlock(), createBlock("img", { key: 0, src: _imports_0, class: "w-1.8rem -mt1", alt: "" })) : (openBlock(), createBlock("img", { key: 1, src: _imports_1, alt: unref(reactiveProjectName), class: "w-1.8rem -mt1" }, null, 8, ["alt"])) ], 8, ["onClick"]) ]; } }), _: 1 }, _parent)); } else { _push(``); } if (unref(getToken)() && unref(config).isSeller) { _push(ssrRenderComponent(_component_a_popover, { open: visibleAdd.value, "onUpdate:open": ($event) => visibleAdd.value = $event, trigger: "click" }, { content: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`
${ssrInterpolate(unref(config).useString("product"))}
${ssrInterpolate(unref(config).useString("story"))}
`); } else { return [ createVNode("div", null, [ createVNode("div", { class: "flex items-center gap-2", onClick: ($event) => unref(router).push({ name: "add-product" }) }, [ createVNode("img", { src: _imports_2, class: "w-1rem", alt: unref(reactiveProjectName) }, null, 8, ["alt"]), createVNode("div", null, toDisplayString(unref(config).useString("product")), 1) ], 8, ["onClick"]), createVNode("div", { class: "flex items-center gap-2 mt-2", onClick: ($event) => unref(router).push({ name: "add-story" }) }, [ createVNode("img", { src: _imports_3, class: "w-1rem", alt: unref(reactiveProjectName) }, null, 8, ["alt"]), createVNode("div", null, toDisplayString(unref(config).useString("story")), 1) ], 8, ["onClick"]) ]) ]; } }), default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(ssrRenderComponent(_sfc_main$6, { class: "w-1.4rem" }, null, _parent2, _scopeId)); } else { return [ createVNode(_sfc_main$6, { class: "w-1.4rem" }) ]; } }), _: 1 }, _parent)); } else { _push(``); } if (unref(getToken)() && !unref(config).isSeller) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:profile-circle" }, null, _parent)); _push(`
`); } else { _push(``); } if (!unref(getToken)()) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:login" }, null, _parent)); _push(`
`); } else { _push(``); } _push(ssrRenderComponent(_sfc_main$5, { class: "w-1.3rem", onClick: ($event) => unref(router).push({ name: "user-setting" }) }, null, _parent)); _push(`
`); _push(ssrRenderComponent(UserProfilePic, { src: (_b = seller.value) == null ? void 0 : _b.avatar, onClick: ($event) => { var _a22, _b22, _c22, _d22; return ((_b22 = (_a22 = userStory.value) == null ? void 0 : _a22.stories) == null ? void 0 : _b22.length) === 0 || !((_c22 = userStory.value) == null ? void 0 : _c22.stories) ? "" : selectedStoryId.value = (_d22 = seller.value) == null ? void 0 : _d22.id; }, "just-show-profile": ((_d = (_c = userStory.value) == null ? void 0 : _c.stories) == null ? void 0 : _d.length) === 0 || !((_e = userStory.value) == null ? void 0 : _e.stories), seenStory: !((_g = (_f = userStory.value) == null ? void 0 : _f.stories) == null ? void 0 : _g.length) || ((_i = (_h = userStory.value) == null ? void 0 : _h.stories) == null ? void 0 : _i.every((item) => item.storyviews.find((_item) => { var _a22; return _item.user_id === ((_a22 = unref(user).user) == null ? void 0 : _a22.id) || _item.user_id === "me"; }))), showAdd: unref(config).isSeller }, null, _parent)); _push(`
${ssrInterpolate(formatNumber((_a2 = (_k = (_j = seller.value) == null ? void 0 : _j.stats) == null ? void 0 : _k.total_product) != null ? _a2 : 0))}
${ssrInterpolate(unref(config).useString("products"))}
`); if (unref(config).isSeller) { _push(`
${ssrInterpolate(formatNumber((_b2 = (_m = (_l = seller.value) == null ? void 0 : _l.stats) == null ? void 0 : _m.total_customer) != null ? _b2 : 0))}
${ssrInterpolate(unref(config).useString("customers"))}
`); } else { _push(``); } _push(`
${ssrInterpolate(formatNumber(unref(config).isSeller ? (_c2 = (_o = (_n = seller.value) == null ? void 0 : _n.stats) == null ? void 0 : _o.sell_total_order_count) != null ? _c2 : 0 : (_d2 = (_r = (_q = (_p = unref(user)) == null ? void 0 : _p.user) == null ? void 0 : _q.stats) == null ? void 0 : _r.buy_total_order_count) != null ? _d2 : 0))}
${ssrInterpolate(unref(config).isSeller ? unref(config).useString("orders") : unref(config).useString("yourOrders"))}
${ssrInterpolate((_s = seller.value) == null ? void 0 : _s.bio)}
`); if ((_t = seller.value) == null ? void 0 : _t.website) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:link-1", class: "text-primary", size: "20" }, null, _parent)); _push(` ${ssrInterpolate((_v = seller.value) == null ? void 0 : _v.website)}
`); } else { _push(``); } if (unref(getToken)()) { _push(`
`); _push(ssrRenderComponent(_sfc_main$3, { size: "small", block: "", class: ["!h-unset !rounded-lg", unref(config).isNightStore ? "border-white text-white bg-black" : "border-black text-black"], onClick: ($event) => unref(router).push({ name: "user-edit" }) }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`${ssrInterpolate(unref(config).useString("editProfile"))}`); } else { return [ createTextVNode(toDisplayString(unref(config).useString("editProfile")), 1) ]; } }), _: 1 }, _parent)); _push(ssrRenderComponent(_sfc_main$3, { size: "small", block: "", class: ["!h-unset !rounded-lg", unref(config).isNightStore ? "border-white text-white bg-black" : "border-black text-black"], onClick: ($event) => shareProfile() }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`${ssrInterpolate(unref(config).useString("shareStore"))}`); } else { return [ createTextVNode(toDisplayString(unref(config).useString("shareStore")), 1) ]; } }), _: 1 }, _parent)); _push(`
`); } else { _push(``); } if ((_w = unref(config)) == null ? void 0 : _w.isSeller) { _push(`
`); _push(ssrRenderComponent(Highlights, { "current-user": seller.value }, null, _parent)); _push(`
`); } else { _push(``); } _push(`
`); ssrRenderList(unref(userPost).posts, (post, i) => { var _a3; var _a22, _b22, _c22, _d22, _e2; _push(`
`); if ((_a22 = post.files) == null ? void 0 : _a22.length) { _push(``); if (((_b22 = post.files[0]) == null ? void 0 : _b22.type) === "image") { _push(`${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : (_a3 = _temp0.innerHTML) != null ? _a3 : ""}`); } else if (((_c22 = post.files[0]) == null ? void 0 : _c22.type) === "video") { _push(`
`); } else { _push(``); } _push(``); } else { _push(``); } _push(`
`); }); _push(`
load
`); if (unref(userPost).loading) { _push(ssrRenderComponent(_sfc_main$4, null, null, _parent)); } else { _push(``); } _push(`
`); if (selectedStoryId.value) { _push(ssrRenderComponent(_sfc_main$7, { 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-17ec452d"]]); 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 }; //# sourceMappingURL=index-D65Gdh7a.mjs.map