import { defineComponent, unref, withCtx, createVNode, createBlock, openBlock, mergeProps, ref, computed, withAsyncContext, watch, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrRenderAttrs, ssrRenderAttr, ssrInterpolate, ssrRenderList, ssrRenderStyle } from 'vue/server-renderer';
import { a as useConfigStore, u as useRouter$1, b as useUserStore, p as useCartStore, q as APP_TYPE, t as reactiveProjectName, c as appName, _ as __nuxt_component_0$1, n as useIntersectionObserver, w as getProducts, o as getToken, e as api$1 } from './server.mjs';
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
import { _ as _imports_0$1, a as _imports_1$1 } from './cart-DMkYna66.mjs';
import { p as publicAssetsURL } from '../_/nitro.mjs';
import { e as _sfc_main$3$1, _ as _sfc_main$2$1, a as _sfc_main$1$1, b as _sfc_main$7, d as deletePostLike, c as createPostLike } from './CommentAddEdit-BK-JfAsk.mjs';
import { _ as _sfc_main$8 } from './moreOptionProduct-D14RzOF_.mjs';
import { d as deleteSave, c as createSave } from './save-kY8A0w-Z.mjs';
import { u as useProductStore } from './product-Crkl8I0V.mjs';
import { u as useAsyncData } from './asyncData-B6TRojJ5.mjs';
import { _ as _sfc_main$6 } from './FullScreenStories-DcEzAgjZ.mjs';
import { u as useMediaStore } from './media-kxpEX2xr.mjs';
import { U as UserProfilePic } from './UserProfilePic-DXA233hi.mjs';
import { B as Badge } from './index-CjBj1lyG.mjs';
import { _ as __nuxt_component_2 } from './index-zdsu3rBC.mjs';
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 '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 './empty_user-BaUNCdgf.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-BiySI7bp.mjs';
import './BasicIconOld-I4c2ShMu.mjs';
import './like-BhIOg3YL.mjs';
import 'vue-content-loader';
import './index-CJwAwTiP.mjs';
import '@vueuse/gesture';
import '@headlessui/vue';
import 'framesync';
import 'popmotion';
import 'style-value-types';
import './BasicButton-BAlnoE_w.mjs';
import './index-DqCYDGJX.mjs';
import 'throttle-debounce';
import './index-Dxyzjwb5.mjs';
import './raf-ruCY1ktO.mjs';
import 'dom-align';
import './index-BlNIpVst.mjs';
import './shallowequal-DbdDzF9p.mjs';
import 'lodash-es/uniq.js';
import './Overflow-Blz4Z5FW.mjs';
import './BaseInput-_gwhwanN.mjs';
import 'resize-observer-polyfill';
import './collapseMotion-cQ2SGjCA.mjs';
import './slide-Bfj4jnqX.mjs';
import './FormItemContext-CDDW52IT.mjs';
import './statusUtils-C3ZNzkeD.mjs';
import './index-C1mihc8c.mjs';
import './handle-DWGYMl2T.mjs';
import './BasicInput-BEP6ZgUl.mjs';
import './usePrice-B-5-jXKQ.mjs';
import './index--Q-kfs0Q.mjs';
import '../_/SearchOutlined.mjs';
import 'lodash-es/isPlainObject.js';
import './media-BbtM6xvT.mjs';
import '../_/CheckOutlined.mjs';
import './useRefs-BHKrVg4I.mjs';
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
__name: "InstallButton",
__ssrInlineRender: true,
setup(__props) {
ref(false);
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 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c11cee2c"]]);
const _imports_0 = publicAssetsURL("/logo_white.png");
const _imports_1 = publicAssetsURL("/logo.png");
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
__name: "Logo",
__ssrInlineRender: true,
setup(__props) {
const config = useConfigStore();
return (_ctx, _push, _parent, _attrs) => {
if (unref(config).isNightStore) {
_push(``);
} 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 _sfc_main$3 = /* @__PURE__ */ defineComponent({
__name: "Posts",
__ssrInlineRender: true,
props: {
userPostScroll: {},
scrollSave: {}
},
async setup(__props) {
let __temp, __restore;
const router = useRouter$1();
const config = useConfigStore();
const posts = ref([]);
const total = ref(100);
const currentPage = ref(0);
const limit = ref(10);
const endPage = ref(false);
const loading = ref(false);
const addLikeLoading = ref(false);
const commentPostId = ref();
const commentVisible = ref(false);
const optionVisible = ref(false);
const optionPostId = ref();
const props = __props;
const user = useUserStore();
computed(() => props.userPostScroll === "userPostScroll");
const percent = useProductStore();
ref(null);
const reset = () => {
endPage.value = false;
posts.value = [];
total.value = 0;
};
function handleLike(isLiked, id) {
var _a, _b;
try {
addLikeLoading.value = true;
if (getToken()) {
if (isLiked) {
deletePostLike(id);
const index = posts.value.findIndex((x) => x.id === id);
(_b = posts.value[index]) == null ? void 0 : _b.likes.splice((_a = posts.value[index].likes) == null ? void 0 : _a.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 handleSave(isSaved, id) {
var _a, _b;
if (getToken()) {
if (isSaved) {
deleteSave(id);
const index = posts.value.findIndex((x) => x.id === id);
(_b = posts.value[index]) == null ? void 0 : _b.saved.splice((_a = posts.value[index].saved) == null ? void 0 : _a.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) {
commentPostId.value = id;
commentVisible.value = true;
}
const request = async (page = 1) => {
try {
loading.value = true;
const res = await getProducts(page, limit.value);
return res;
} catch (e) {
console.error(e);
return { data: [], count: 0 };
} finally {
loading.value = false;
}
};
const { data } = ([__temp, __restore] = withAsyncContext(() => useAsyncData("posts", async () => {
return request(1);
})), __temp = await __temp, __restore(), __temp);
const observer = ref();
useIntersectionObserver(observer, async ([{ isIntersecting }]) => {
var _a, _b;
if (isIntersecting && !loading.value && !endPage.value) {
const nextPage = currentPage.value + 1;
const res = await request(nextPage);
if ((_a = res.data) == null ? void 0 : _a.length) {
posts.value.push(...res.data);
currentPage.value = nextPage;
}
if (((_b = res.data) == null ? void 0 : _b.length) < limit.value) {
endPage.value = true;
}
}
});
computed(() => router.currentRoute.value.query.target || null);
const present = computed(() => percent.percentUpload);
watch(present, () => {
if (present.value == 100) {
currentPage.value = 0;
reset();
request();
}
});
return (_ctx, _push, _parent, _attrs) => {
_push(`