Files
appco_dist/.output/server/chunks/build/index-Dc6P9620.mjs
T
2026-02-01 17:38:39 +03:30

406 lines
16 KiB
JavaScript

import { defineComponent, computed, unref, ref, watch, mergeProps, withAsyncContext, provide, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate, ssrRenderList, ssrRenderStyle } from 'vue/server-renderer';
import { a as useConfigStore, u as useRouter$1, b as useUserStore, o as useCartStore, p as usePriceStore, _ as __nuxt_component_0$1, m as useIntersectionObserver, n as getToken, d as api$1 } from './server.mjs';
import { P as Post, _ as _sfc_main$7 } from './PostCardSkeleton-BfG9M_Aj.mjs';
import { C as CommentAddEdit, _ as _sfc_main$8, d as deletePostLike, c as createPostLike } from './moreOptionProduct-DGhUOthE.mjs';
import { d as deleteSave, c as createSave } from './save-6qQTYFWc.mjs';
import { u as useProductStore } from './product-C4ZOggJK.mjs';
import { u as useMediaStore } from './media-SggCY0jL.mjs';
import { u as useAsyncData } from './asyncData-CZ9BKXPA.mjs';
import { storeToRefs } from 'pinia';
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
import { _ as _sfc_main$6 } from './FullScreenStories-DfqBumN3.mjs';
import { U as UserProfilePic } from './UserProfilePic-XzJNxY0K.mjs';
import { u as usePrice } from './usePrice-_QzChhgO.mjs';
import { _ as __nuxt_component_2 } from './index-fviVuNo9.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 '@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 './empty_user-DSxcM_ac.mjs';
import './useDateTime-D8RCoGwW.mjs';
import 'moment';
import 'moment-timezone';
import 'moment-jalaali';
import 'date-fns';
import 'date-fns/locale';
import 'swiper/vue';
import 'swiper/modules';
import './post_loading-CMOcYm9B.mjs';
import './BasicIconOld-93vAWohq.mjs';
import './like-BhIOg3YL.mjs';
import 'vue-content-loader';
import './index-x7G4qpPf.mjs';
import '@vueuse/gesture';
import '@headlessui/vue';
import 'framesync';
import 'popmotion';
import 'style-value-types';
import './BasicButton-CNera6n7.mjs';
import './index--iRd5AYr.mjs';
import 'throttle-debounce';
import './index-Bpb_QU26.mjs';
import 'dom-align';
import './index-CGkJdmtz.mjs';
import './shallowequal-B7epstpr.mjs';
import 'lodash-es/uniq.js';
import './index-xCOPbDMH.mjs';
import './FormItemContext-p68sljID.mjs';
import './index-DgsBGZQx.mjs';
import 'lodash-es/isPlainObject.js';
import 'resize-observer-polyfill';
import './index-Cq494RwS.mjs';
import './media-_NDkNIvH.mjs';
import 'perfect-debounce';
import './BasicInput-CldcPa4f.mjs';
import '../_/CheckOutlined.mjs';
import './useRefs-BHKrVg4I.mjs';
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
__name: "InstallButton",
__ssrInlineRender: true,
setup(__props) {
ref(false);
ref(null);
return (_ctx, _push, _parent, _attrs) => {
const _component_ClientOnly = __nuxt_component_0$1;
_push(ssrRenderComponent(_component_ClientOnly, _attrs, {}, _parent));
};
}
});
const _sfc_setup$5 = _sfc_main$5.setup;
_sfc_main$5.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/InstallButton.vue");
return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
};
const __nuxt_component_0 = Object.assign(_sfc_main$5, { __name: "InstallButton" });
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
__name: "Logo",
__ssrInlineRender: true,
setup(__props) {
const config = useConfigStore();
const logoSrc = computed(() => {
if (!config.STORAGE_LOGO) {
console.warn("⚠️ STORAGE_LOGO is empty");
return "";
}
const logo = config.isNightStore ? "logo_full_white.png" : "logo_full.png";
const fullPath = config.useLogo(logo);
console.log("🖼️ Logo computed:", fullPath);
return fullPath;
});
ref(false);
watch(() => config.STORAGE_LOGO, (newVal) => {
console.log("🔄 STORAGE_LOGO changed:", newVal);
});
return (_ctx, _push, _parent, _attrs) => {
if (!logoSrc.value) {
_push(`<span${ssrRenderAttrs(_attrs)}>${ssrInterpolate(unref(config).appName.en)}</span>`);
} else {
_push(`<img${ssrRenderAttrs(mergeProps({
key: logoSrc.value,
src: logoSrc.value,
alt: unref(config).appName.en,
class: "inline"
}, _attrs))}>`);
}
};
}
});
const _sfc_setup$4 = _sfc_main$4.setup;
_sfc_main$4.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Logo.vue");
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
};
const Logo = Object.assign(_sfc_main$4, { __name: "Logo" });
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
__name: "Posts",
__ssrInlineRender: true,
props: {
userPostScroll: {},
scrollSave: {}
},
async setup(__props) {
let __temp, __restore;
const props = __props;
const user = useUserStore();
const media = useMediaStore();
const percent = useProductStore();
const router = useRouter$1();
const config = useConfigStore();
ref(100);
const { posts, endPage } = storeToRefs(media);
ref(0);
const loading = ref(false);
const addLikeLoading = ref(false);
const commentPostId = ref();
const commentVisible = ref(false);
const optionVisible = ref(false);
const optionPostId = ref();
const ownerPostId = ref();
computed(() => props.userPostScroll === "userPostScroll");
const present = computed(() => percent.percentUpload);
function handleLike(isLiked, id) {
try {
addLikeLoading.value = true;
if (getToken()) {
if (isLiked) {
deletePostLike(id);
const index = posts.value.findIndex((x) => x.id === id);
posts.value[index]?.likes.splice(posts.value[index].likes?.findIndex((y) => y.user_id === user.user.id));
} else {
createPostLike(id);
const index = posts.value.findIndex((x) => x.id === id);
posts.value[index]?.likes.push({
product_id: id,
user_id: user.user.id
});
}
} else {
router.push({ name: "auth-login" });
api$1.warn(config.useString("pleaseLoginOrRegister"));
}
} catch (e) {
console.log(e);
} finally {
addLikeLoading.value = false;
}
}
function addCommentId(id) {
posts.value[posts.value.findIndex((x) => x.id === commentPostId.value)]?.comments.push({ id });
}
function deleteCommentId() {
posts.value[posts.value.findIndex((x) => x.id === commentPostId.value)]?.comments.splice(0, 1);
}
function handleSave(isSaved, id) {
if (getToken()) {
if (isSaved) {
deleteSave(id);
const index = posts.value.findIndex((x) => x.id === id);
posts.value[index]?.saved.splice(posts.value[index].saved?.findIndex((y) => y.user_id === user.user.id));
} else {
createSave(id);
const index = posts.value.findIndex((x) => x.id === id);
posts.value[index]?.saved.push({
product_id: id,
user_id: user.user.id
});
}
} else {
router.push({ name: "auth-login" });
api$1.warn(config.useString("pleaseLoginOrRegister"));
}
}
function openOption(id) {
optionPostId.value = id;
optionVisible.value = true;
}
function openComment(id, owner_id) {
commentPostId.value = id;
commentVisible.value = true;
ownerPostId.value = owner_id;
}
provide("ownerPostId", ownerPostId);
const { data } = ([__temp, __restore] = withAsyncContext(() => useAsyncData("posts", () => media.loadPosts(1))), __temp = await __temp, __restore(), __temp);
const observer = ref();
useIntersectionObserver(observer, async (entries) => {
const entry = entries[0];
if (!entry) return;
if (entry.isIntersecting && !media.loading && !media.endPage) {
await media.loadPosts(media.currentPage + 1);
}
});
computed(() => router.currentRoute.value.query.target || null);
watch(present, () => {
if (present.value == 100) {
media.reset();
media.loadPosts(1);
}
});
return (_ctx, _push, _parent, _attrs) => {
_push(`<!--[--><div class="mt-5 pb-5vh" data-v-06dbf9e8><!--[-->`);
ssrRenderList(unref(posts), (post, index) => {
_push(ssrRenderComponent(Post, {
onOpenOption: openOption,
onOpenComment: openComment,
onHandleLike: handleLike,
onHandleSave: handleSave,
index,
post,
key: index,
scrollSave: _ctx.scrollSave,
"add-like-loading": addLikeLoading.value
}, null, _parent));
});
_push(`<!--]-->`);
if (loading.value) {
_push(ssrRenderComponent(_sfc_main$7, null, null, _parent));
} else {
_push(`<!---->`);
}
_push(`<div style="${ssrRenderStyle(!loading.value ? null : { display: "none" })}" class="w-full opacity-0 relative" data-v-06dbf9e8> load </div></div>`);
_push(ssrRenderComponent(CommentAddEdit, {
id: commentPostId.value,
open: commentVisible.value,
"onUpdate:open": ($event) => commentVisible.value = $event,
onAddCommentId: addCommentId,
onDeleteCommentId: deleteCommentId
}, null, _parent));
_push(ssrRenderComponent(_sfc_main$8, {
id: optionPostId.value,
open: optionVisible.value,
"onUpdate:open": ($event) => optionVisible.value = $event
}, null, _parent));
_push(`<!--]-->`);
};
}
});
const _sfc_setup$3 = _sfc_main$3.setup;
_sfc_main$3.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/home/components/Posts.vue");
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const Posts = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-06dbf9e8"]]);
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "CustomStories",
__ssrInlineRender: true,
async setup(__props) {
let __temp, __restore;
const selectedStoryId = ref(null);
ref(null);
ref(false);
const mediaStore = useMediaStore();
const userStore = useUserStore();
const { data } = ([__temp, __restore] = withAsyncContext(() => useAsyncData("story", () => mediaStore.getList())), __temp = await __temp, __restore(), __temp);
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({ class: "stories-container -ms4" }, _attrs))} data-v-c6b78541><div class="scroll-wrapper ps-4" data-v-c6b78541><!--[-->`);
ssrRenderList(unref(mediaStore).users, (user) => {
_push(`<div class="story" data-v-c6b78541>`);
_push(ssrRenderComponent(UserProfilePic, {
src: user.avatar,
seenStory: !user?.stories?.length || user.stories.every((item) => item.storyviews.find((_item) => _item.user_id === unref(userStore).user?.id || _item.user_id === "me")),
showAdd: user.id === unref(userStore).user?.id
}, null, _parent));
_push(`<div class="w-full text-center mt1 text-xs truncate" data-v-c6b78541>${ssrInterpolate(user.name)}</div></div>`);
});
_push(`<!--]--></div>`);
if (selectedStoryId.value) {
_push(ssrRenderComponent(_sfc_main$6, {
id: selectedStoryId.value,
"onUpdate:id": ($event) => selectedStoryId.value = $event
}, null, _parent));
} else {
_push(`<!---->`);
}
_push(`</div>`);
};
}
});
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/home/components/CustomStories.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const CustomStories = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-c6b78541"]]);
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
setup(__props) {
const config = useConfigStore();
const percent = useProductStore();
useRouter$1();
useUserStore();
useCartStore();
const onlinePrices = usePriceStore();
const header = config.TEXT_HEADER;
const tala18 = computed(() => onlinePrices?.tala18);
return (_ctx, _push, _parent, _attrs) => {
const _component_InstallButton = __nuxt_component_0;
const _component_ClientOnly = __nuxt_component_0$1;
const _component_AProgress = __nuxt_component_2;
_push(`<div${ssrRenderAttrs(_attrs)}><div class="absolute top-0 w-inherit right-0 left-0 h-screen overflow-hidden overflow-y-hidden flex flex-col"><div class="flex-col flex overflow-hidden flex-shrink-0"><div class="flex justify-between w-full p-4">`);
_push(ssrRenderComponent(Logo, { class: "h-2rem" }, null, _parent));
_push(`<div class="flex items-center gap-3">`);
if (unref(config).APP_HAS_GOLD && unref(config).PRICE_HEADER && unref(tala18)) {
_push(`<div class="border-1 border-solid p-2px rounded"><div class="font-semibold flex gap-1">${ssrInterpolate(
// usePrice((tala18/1000)?? 0,true,'')
unref(usePrice)(unref(tala18) / 10, true, "")
)} <div class="text-xs text-center w-full">${ssrInterpolate(unref(config).useString("toman"))}</div></div><div class="text-xs text-center">${ssrInterpolate(unref(config).useString("goldGramPrice"))}</div></div>`);
} else {
_push(`<!---->`);
}
_push(ssrRenderComponent(_component_InstallButton, { class: "w-10" }, null, _parent));
_push(ssrRenderComponent(_component_ClientOnly, null, {}, _parent));
_push(`</div></div><div class="flex justify-between"></div>`);
if (unref(header) != "") {
_push(`<div class="text-center pb-2 leading-relaxed text-xs">${unref(header) ?? ""}</div>`);
} else {
_push(`<!---->`);
}
_push(`</div><div class="flex-1 overflow-y-auto overflow-x-hidden pb-10vh scrollHome min-h-0">`);
_push(ssrRenderComponent(CustomStories, { class: "" }, null, _parent));
if (unref(percent).percentUpload != 100 && unref(percent).loading) {
_push(ssrRenderComponent(_component_AProgress, {
percent: unref(percent).percentUpload,
"show-info": false,
status: "active",
size: "small"
}, null, _parent));
} else {
_push(`<!---->`);
}
_push(ssrRenderComponent(Posts, {
"user-post-scroll": "scrollHome",
"scroll-save": "scrollPosition"
}, null, _parent));
_push(`</div></div></div>`);
};
}
});
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/home/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/home/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };