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(`${ssrInterpolate(unref(config).appName.en)}`);
} else {
_push(``);
}
};
}
});
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(`